EasyUI Forum
May 07, 2024, 04:04:45 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: [SOLVED] Cascade Combogrid - load data after select of first combogrid  (Read 12382 times)
acreonte82
Jr. Member
**
Posts: 85



View Profile
« 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

« Last Edit: October 08, 2013, 05:39:44 AM by acreonte82 » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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});
}
});
Logged
acreonte82
Jr. Member
**
Posts: 85



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