EasyUI Forum
September 14, 2025, 04:02:43 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to set text field with 2 or more columns for combogrid  (Read 8751 times)
dailyblog
Newbie
*
Posts: 30


View Profile Email
« 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.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2298


View Profile Email
« Reply #1 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>
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!