I have a jqgrid prepopulated with data. Clicking on any row will send 4 ajax requests to fetch the details (4 jsp pages get loaded). 3 pages has new jqgrids in that.
I have an external search and clear option on the first grid (jsp page). It works fine any # of times. But once I fetch the other pages with grids, the search and clear doesn't work. Ofcourse the script is getting executed but not the trigger.
I did see some solutions and have applied all but to no avail.
Grid 1:
<sjg:grid
autowidth="true"
id="assetgridtable"
caption="List of Assets"
dataType="json"
href="%{remoteurl}"
pager="true"
navigator="false"
navigatorSearch="false"
navigatorAdd="false"
navigatorEdit="false"
navigatorDelete="false"
navigatorView="false"
navigatorExtraButtons="{
seperator: {
title : 'seperator'
}
}"
gridModel="gridModel"
rowList="10,15,20,30,50"
rowNum="15"
shrinkToFit="true"
viewrecords="true"
onSelectRowTopics="rowselect"
loadonce="false">
Below is the subscription code for rowselect.
$.subscribe('rowselect',
function(event, data){
var id = event.originalEvent.id;
$.ajax(
{
type : 'GET',
url : "displayAsset.action",
cache : false,
data :
{
"id" : id
},
success : function(result)
{
$("#dataassetshow").append('<div id="assetshow"></div>');
$("#assetshow").html(result);
$("#assetshow").css(
{
"text-align" : "center",
}).show("fast");
}
});
I am showing only one of the ajax calls, likewise 3 more calls are there that fetches other grids.
Now the search code
$('#searchAsset').on('submit', function(event)
{
$("#assetgridtable").jqGrid('setGridParam',
{
type : 'GET',
url : "listAsset.action",
page : 1,
datatype : 'json',
cache : false,
gridview : true,
postData :
{
"search" : function()
{
return true;
},
"searchText" : function()
{
return $('#searchText').val();
},
"option" : function()
{
return $('input[name=option]:checked').val();
},
"from" : function()
{
return $('#from').val();
},
"to" : function()
{
return $('#to').val();
},
},
}).trigger('reloadGrid');
event.preventDefault();
});
As already specified, the above code works fine all the time but when other grids are fetched, it doesn't trigger the reload!!!