EasyUI Forum
May 02, 2024, 10:31:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Prepopulate the multiple combogrids with data from server.  (Read 4688 times)
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« 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. Please look at the comment in the code

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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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'.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!