Hi.
New to the forum so this is probably easy to answer...
This is based on this tutorial:
http://www.jeasyui.com/tutorial/datagrid/datagrid12.phpI have created a datagrid.
One of the fields is an integer-type field, with its editor set to combobox.
My combobox is loaded with data from a mysql db, not local array data.
The integer is based on a lookup table other than the table the datagrid is based on.
1) How do I populate the combobox with remote data?
2) How do I display not the integer but a field from the remote table (the lookup table)
$('#tt').datagrid({
title:'Estimate Line Items',
iconCls:'icon-edit',
width:1200,
height:650,
singleSelect:true,
idField:'estimatelinedetail_id',
url:'data_select.php',
columns:[[
{field:'estimatelinedetail_id',title:'ID',width:60},
{field:'item_id',title:'Item Code',width:300,
editor:{
type:'combobox',
options:{
mode:'remote',
url:'item_id_select.php',
valueField:'item_id',
textField:'ItemCode',
required:true
}
}
},
{field:'Description',title:'Description',width:300,align:'left',editor:'textarea'},
{field:'Quantity',title:'Quantity',width:100,align:'right',editor:'numberbox'},
{field:'PurchaseRate',title:'Purchase Rate',width:180,align:'right',editor:'numberbox'},
{field:'NetTotal',title:'Net Total',width:100,align:'right',editor:'numberbox'},
{field:'action',title:'Action',width:90,align:'center',
formatter:function(value,row,index){
if (row.editing){
var s = '<a href="#" onclick="saverow(this)">Save</a> ';
var c = '<a href="#" onclick="cancelrow(this)">Cancel</a>';
return s+c;
} else {
var e = '<a href="#" onclick="editrow(this)">Edit</a> ';
var d = '<a href="#" onclick="deleterow(this)">Delete</a>';
return e+d;
}
}
}
]],
data_select.php extracts data into json for my datagrid
item_id_select.php extracts data into json for my combobox lookup
The above displays item_id from the datagrid table. I want to get the 'ItemCode' field from my look up table.
The combobox doesn't load any data.
Can anyone help? Thanks