[jQuery] JQuery, JqGrid, and Ajax
Hello:
I am trying to develop a similar functionality as here:http://
koshersavings.ca/SelectItems.php
When the user to clicks an row item, I want items to be loaded based
on the selection, dynamically.
I am trying to do the same, but using jqgrid, and ajax.
The current code is here: (also note below)
http://pssnet.com/~devone/ajqtable/summary35.html
Basically, when the user double clicks it loads a corresponding
table. But, when they select another, it will not reloaded. Any help
appreciated. Thanks.
Regards,
Nat
ondblClickRow: function(id){
var x = id;
alert("You double click row with id: "+id);
// Load Dynamic Data
jQuery("#list3").jqGrid({
datatype: function(postdata){
jQuery.ajax({
url:'get_services.php?name='+x,
data:postdata,
datatype: "json",
complete: function (jsondata, stat){
if(stat=="success"){
var thegrid = jQuery("#list3")[0];
thegrid.addJSONData(eval("("+jsondata.responseText+")"));
alert("yes");
}
else{
alert("no");
}
} // end complete
}); // end ajax
}, // end datatype
colNames:['Product No', 'Name', 'type'],
colModel:[
{name:'product_id',index:'product_id', width:75},
{name:'name',index:'name', width:100},
{name:'type',index:'type', width:100},
],
pager: jQuery('#pager3'),
rowNum:10,
rowList:[10,20,30],
imgpath: 'themes/sand/images',
sortname: 'id',
viewrecords: true,
sortorder: "asc"
});
}, //end ondblClickRow function