EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sherzodr on February 27, 2014, 12:21:55 AM



Title: Using combogrid in a datagrid cell
Post by: sherzodr on February 27, 2014, 12:21:55 AM
Hi,

I grew comfortable with using datagrid and combogrid. But now I'm trying to use combogrid in a cell of an editable datagrid. Anyone has tried it before?

Thank you!!!


Title: Re: Using combogrid in a datagrid cell
Post by: stworthy on February 27, 2014, 12:47:52 AM
The 'combogrid' editor is not included in standard version, please extend it as below:
Code:
$.extend($.fn.datagrid.defaults.editors, {
combogrid: {
init: function(container, options){
var combo = $('<input type="text">').appendTo(container);
combo.combogrid(options);
return combo;
},
destroy: function(target){
$(target).combogrid('destroy');
},
getValue: function(target){
var opts = $(target).combogrid('options');
if (opts.multiple){
return $(target).combogrid('getValues').join(opts.separator);
} else {
return $(target).combogrid('getValue');
}
},
setValue: function(target, value){
var opts = $(target).combogrid('options');
if (opts.multiple){
if (value){
$(target).combogrid('setValues', value.split(opts.separator));
} else {
$(target).combogrid('clear');
}
} else {
$(target).combogrid('setValue', value);
}
},
resize: function(target, width){
$(target).combogrid('resize', width)
}
}
})


Title: Re: Using combogrid in a datagrid cell
Post by: Stefan B. on March 24, 2015, 04:01:41 AM
I test this and it is not working on my side.
Can one help me to implement a combogrid in datagrid?


Title: Re: Using combogrid in a datagrid cell
Post by: stworthy on March 24, 2015, 07:41:14 AM
The combogrid editor has been integrated into the core package since version 1.3.6.


Title: Re: Using combogrid in a datagrid cell
Post by: Stefan B. on March 24, 2015, 08:40:03 AM
OK. But it is not in the documentation of the datagrid page:
http://www.jeasyui.com/documentation/datagrid.php


Title: Re: Using combogrid in a datagrid cell
Post by: thecyberzone on March 24, 2015, 08:58:42 AM
Field declaration for combogrid may be written as follows:

Code:
{field:'secode2',title:'Section',width:100,align:'left',
editor:{
    type:'combogrid',
    options:{
    idField: 'secode2', textField: 'section',
url: 'getSection.php',
mode: 'remote',
fitColumns:true,
columns: [[
{field:'secode2',title:'SeCode',width:60,align:'right'},
{field:'secode',width:0,hidden:true},
{field:'section2',width:0, hidden:true},
{field:'section',title:'Section',width:260},
{field:'deptname',title:'Department',width:200}
]],
panelHeight:135
    }
}
}