Forum
20:12
05/02/2009
I have a chained select box in a form edit window. I have a function that populates the second select box (scategory) based on the value of the first one (category). This function is based on this example.
var selected_category = parseInt($(e.target).val(),10);
var account = $('#account').val();
$.ajax({
url:"SELBX_SCAT.php?cat="+selected_category+"&acct="+account,
dataType:"html",
success:function(newOptions){
var form = $(e.target).closest("form.FormGrid");
$("select#scategory.FormElement",form[0]).html(newOptions);
}
});
}
I attach it to the colModel like this:
dataUrl:'SELBX_CAT.php?account='+$('#account').val(),
dataEvents:[{
type:"change",
fn:function(e){
subcategory_selectbox(e);
}
}]
},…
This works perfectly, but I can't figure out how to pass that same variable "e" from other places. For instance, I have a beforeShowForm function that I would like to be able to call subcategory_selectbox() from, but I don't know what to pass. How do I pass the same variable "e" as the dataEvents function does?
Also, on my account select box, I have the following function to trigger onChange:
$('#transGrid').setColProp('category',{
editoptions:{
dataUrl:'SELBX_CAT.php?account='+$('#account').val()
}
});
$('#transGrid').setGridParam({postData:{account:$('#account').val()}});
$('#transGrid').trigger('reloadGrid');
});
This does the trick as far as basing the values of the category select box on the currently selected account, but it no longer executes the dataEvents function. I even tried including the same dataEvents code from the second code snippet in this post, but it didn't work either. How can I keep the category select box based on the account select box without eliminating the dataEvents function?
Most Users Ever Online: 715
Currently Online:
45 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66