EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: acreonte82 on October 07, 2013, 01:59:22 AM



Title: [SOLVED] Cascade Combogrid - load data after select of first combogrid
Post by: acreonte82 on October 07, 2013, 01:59:22 AM
Hi to all,
I've a problem or better I don't know how to implement this kind of situation:
I've 3 combogrid and the kind of load data is remote mode.  There are no problems to retrive data and the "live search" function works.
But now I want to load the data after the user selection: the data of second  combogrid is load after the selection of first combogrid .
This is my sample js code for the combogrid
Code:
$(function(){
$('#assay_type_id').combogrid({
panelWidth:500,
url: 'controller/enumerate_assay_type_id.php?man=6',
idField:'id_assay',
textField:'description',
mode:'remote',
fitColumns:true,
columns:[[
{field:'description',title:'Assay',width:250}
]]
});
$('#sample_type_id').combogrid({
panelWidth:500,
url: 'controller/enumerate_biological_sample_type.php',
idField:'id_biological_sample_type',
textField:'description',
mode:'remote',
fitColumns:true,
columns:[[
{field:'description',title:'Tessuto',width:250}
]]
});
}

How can I extend the combogrid called "sample_type_id" to retrive data after the input of " assay_type_id"?
How I can do this? I tryed to find in the forum some similar situation but with not a good result.

Thanks for all



Title: Re: Cascade Combogrid - load data after select of first combogrid
Post by: stworthy on October 07, 2013, 05:17:54 PM
Please try to attach the 'onChange' event handler to the '#assay_type_id' combogrid.
Code:
$('#assay_type_id').combogrid({
panelWidth:500,
url: 'controller/enumerate_assay_type_id.php?man=6',
idField:'id_assay',
textField:'description',
mode:'remote',
fitColumns:true,
columns:[[
{field:'description',title:'Assay',width:250}
]],
onChange:function(value){
var g = $('#sample_type_id').combogrid('grid');
g.datagrid('load',{assay_type_id:value});
}
});


Title: Re: Cascade Combogrid - load data after select of first combogrid
Post by: acreonte82 on October 08, 2013, 05:39:26 AM
Ohh yes work!!!
I try a different solution and implement 'onSelect' event, but your's is better!!!
Thanks a lot!!!