EasyUI Forum

General Category => General Discussion => Topic started by: mephisto on August 16, 2013, 07:26:59 AM



Title: Chain Combo Inline editor (2) [Solved]
Post by: mephisto on August 16, 2013, 07:26:59 AM
Hi all,
I'm a newbie so sorry in advance for the probably silly question:

I've tried to use the code explained in the topic http://www.jeasyui.com/forum/index.php?topic=559.0 (http://www.jeasyui.com/forum/index.php?topic=559.0) about the chained combobox (city/country) but I don't understand what is and how to use the parameter "idx" in:
Code:
onChange:function(value){
// get the country editor
var ed = $('#dg').datagrid('getEditor',{index:idx,field:'country'});
// reload its data
$(ed.target).combobox('reload','get_data.php?city='+value);

And how to pass in get_data.php the "value".

Thanks in advance.


Title: Re: Chain Combo Inline editor (2)
Post by: chrwei on August 21, 2013, 02:01:24 PM
you might find the linked example in the documentation more clear.  it also shows the json format expected.  http://www.jeasyui.com/documentation/index.php#


Title: Re: Chain Combo Inline editor (2)
Post by: stworthy on August 21, 2013, 05:54:34 PM
Try the code below to get the current editing row index.
Code:
onChange:function(value){
var idx = $(this).closest('tr.datagrid-row').attr('datagrid-row-index');
// get the country editor
var ed = $('#dg').datagrid('getEditor',{index:idx,field:'country'});
// reload its data
$(ed.target).combobox('reload','get_data.php?city='+value);
}


Title: Re: Chain Combo Inline editor (2) [Solved]
Post by: mephisto on August 24, 2013, 12:18:12 PM
Perfect!
your code solved the problem!