EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: finzaiko on December 18, 2013, 02:19:22 AM



Title: Get Combogrid ID
Post by: finzaiko on December 18, 2013, 02:19:22 AM
I tried to make combogrid in edatagrid with onChange remote searching base on topic
http://www.jeasyui.com/forum/index.php?topic=478.0
http://www.jeasyui.com/forum/index.php?topic=1580.msg3523#msg3523

when I reload callback data, how do I get the grid id combogrid ? actually we do not define the combogrid ID

Code:
var unitEditor = {
        type:'combogrid',
        options:{
                panelWidth:260,
                idField:'id',
                textField:'unit_name',
                mode:'remote',
                required:true,
                columns:[[
                        {field:'id',title:'id',width:60},
                        {field:'unit_name',title:'unit',width:200}
                ]],
                onSelect: onSelectGrid,
                onChange:function(value){
                       $('#???').datagrid('load',{ // how get current combogrid ID ???
                        find: value
                    });
                    console.log(value);
                },
                filter: function(q,row){
                        var opts = $(this).combogrid('options');
                        return row[opts.textField].toUpperCase().indexOf(q.toUpperCase()) >= 0;
                },
                data: itemList
        }
       
   

I appreciate and thanks for help.




Title: Re: Get Combogrid ID
Post by: stworthy on December 18, 2013, 03:39:01 AM
Please call 'grid' method of combogrid to get datagrid object.
Code:
onChange:function(value){
$(this).combogrid('grid').datagrid('load',{ // how get current combogrid ID ???
find: value
});
console.log(value);
},


Title: Re: Get Combogrid ID
Post by: finzaiko on December 19, 2013, 02:02:06 AM
Thanks stworthy, Its worked.