Title: Prepopulate the multiple combogrids with data from server.
Post by: Alfred on September 08, 2019, 05:17:07 AM
Is it possible to pre-populate the combogrid in the following code with data from the server. Since the code is too long, I will post here only some important parts of it. You can see the whole code http://code.reloado.com/ipopes/3/edit#source (http://code.reloado.com/ipopes/3/edit#source). Please look at the comment in the code editor:{ type:'combogrid', options:{ mode:'local', panelWidth:500, method:'get', //url: 'getorder.php?id=1', //This will generate all then necessary rows and create and populate the combogrids //url: 'product.php', //If a user choose to change the product, this will generate a combogrid. data: [ {id:'code1',description:'description1',code:'code1',quantity:100,rate:30}, {id:'code2',description:'description2',code:'code2',quantity:200,rate:40} ], queryParams: { type: 'product' }, idField:'id', textField:'description', reversed:true, columns: [[ {field:'description',title:'Description',width:120,sortable:true}, {field:'code',title:'Code No',width:60,sortable:true}, {field:'uqc',title:'UOM',width:50,sortable:true}, {field:'quantity',title:'Qnty',width:40,sortable:true}, {field:'rate',title:'Rate',width:50,sortable:true}, ]], fitColumns:true, selectOnNavigation:false, onSelect: function(index,row){ var combo = $(this).combogrid('combo'); var opts = $(combo).combogrid('options'); var mainGrid = opts.mainGrid; var editIndex = opts.editIndex; var edCode = mainGrid.datagrid('getEditor', {index:editIndex,field:'code'}); var edQuantity = mainGrid.datagrid('getEditor', {index:editIndex,field:'quantity'}); var edRate = mainGrid.datagrid('getEditor', {index:editIndex,field:'rate'}); var edTotal = mainGrid.datagrid('getEditor', {index:editIndex,field:'total'}); $(edCode.target).textbox('setValue', row.code); $(edQuantity.target).numberbox('setValue', 1); $(edRate.target).numberbox('setValue', row.rate); $(edTotal.target).numberbox('setValue', row.rate*1); } } }
In the above code, we have to manually select the product from the code coming from the server `getorder.php`. My question is — Is it possible to populate the combogrid with multiple rows of data coming from the server. And can we still manually change the populated from the combogrid with a new data source such as `product.php`. Your help is truly appreciated. Thanks. Alfred
Title: Re: Prepopulate the multiple combogrids with data from server.
Post by: stworthy on September 09, 2019, 02:48:26 AM
The 'combogrid' has the 'loader' and 'loadFilter' functions to convert any data to the desired format. What's the data from the 'getorder.php' and 'product.php'.
|