EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dailyblog on November 28, 2016, 12:47:13 AM



Title: how to set text field with 2 or more columns for combogrid
Post by: dailyblog on November 28, 2016, 12:47:13 AM
hi, please look at this example:
http://www.jeasyui.com/demo/main/index.php?plugin=ComboGrid&theme=default&dir=ltr&pitem=

How to set text field to "itemid"+"productname"?or how to customize text selected from list.


Title: Re: how to set text field with 2 or more columns for combogrid
Post by: jarry on November 28, 2016, 05:15:38 PM
You can custom the 'loadFilter' function to construct a new combined field, and then set the 'textField' property to this field name. Please look at this code.
Code:
<select class="easyui-combogrid" style="width:100%" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'myfield',
url: 'datagrid_data1.json',
method: 'get',
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120},
{field:'listprice',title:'List Price',width:80,align:'right'},
{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
{field:'attr1',title:'Attribute',width:200},
{field:'status',title:'Status',width:60,align:'center'}
]],
fitColumns: true,
label: 'Select Item:',
labelPosition: 'top',
loadFilter: function(data){
if ($.isArray(data)){
data = {total:data.length,rows:data};
}
$.map(data.rows, function(row){
row.myfield = row.itemid+':'+row.productname;
});
return data;
}
">
</select>