I have selet list where I pass the id to the jqGrid function and I want to load different sets of data according to the id that is selected by the user. So I pass the value as in the change event of the select list.
RelaodGrid($(this).val());
Then I havethe RelaodGridfunction like this.
function RelaodGrid(Id) {
jQuery("#list").jqGrid({
url: '/Home/GridData',
datatype: 'json',
mtype: 'POST',
postData:{Id:Id},
colNames: ['Id', 'Value1', 'Value2'],
colModel: [
{ name: 'Id', index: 'Id', width: 50, align: 'left' },
{ name: 'Value1', index: 'Value1', width: 100, align: 'left' },
{ name: 'Value2', index: 'Value2', width: 100, align: 'left'}],
pager: jQuery('#pager'),
viewrecords: true,
caption: 'Summary'
}).trigger("reloadGrid");
};
This reloads the grid but return the same value.First time it takes the correct Id value but after that for every reload,it takes the first selected id value though the selected list correctly returns the value.
How to solve this issue?Where did I go wrong?? Thanks.