I have constructed the jqgrid
using struts2-jquery-jqgrid
plugins. Everything is working great except paging,
Problem : When I click on the next button in pager, I want to perform some ajax-based operation. I am using onPaging(jqgrid method)
or onPagingTopics
topics(jqgrid-plugins) to trap the paging event. I get this paging event successfully but from here actual problem starts. When I click on next button, I trap the paging event using onPagingTopics Topics, inside this event I call an ajax-request, but before this ajax-request is completed , the jqgrid
is automatically getting reload, and that is why I can not make the ajax-call successfully. Why this is happening and how to restrict jqgrid from reload.
Note: My jqgrid is getting reload by calling the url I have specified inside this grid. You can check the grid here how to load json in jqgrid
This is how I trap the paging Event:
$.subscribe('paging',function(event,data)
{
var search_string=$("#searchString").val();
var search_field=$("#searchField").val();
$.ajax({
url:"adminJsontable?searchString="+search_string,
dataType:"json",
success: function(jsondata,stat)
{
var mgrid = jQuery("#gridtable")[0];
mgrid.addJSONData(jsondata);
}
});
});
Update Section:
$.subscribe('before',function(event,data)
{
var grid = jQuery("#gridtable");
grid.jqGrid('setGridParam',{url:"adminJsontable?searchString="+"neo"});
});
This is how I am changing the url, but its not working. This way I can get any events like ready, complete,success. Please guide me now wht I have to do.
Note : I can use any methods or any events which is used in jqgrid but don't know how to make it.