I’m having and issue where I want to reload data into a jqxgrid using parameters from a search, and the paging on the grid does not go back to the start as I think it should.
I use a method of updating the source and creating a new dataAdapter and applying that new source to the existing grid. The data loads, but I have tried 2 things with mixed results and not what I’d like:
1) Set the pagenum in the source to 0 – no joy – the page stays on the previously selected page.
2) invoke the “gotopage” method after setting the source:dataAdapter – this works ok, but the source loads twice – once for the previously selected page, and once for the page called with the gotopage method. Setting gotopage before setting the source also loads the source url twice, but it’s uglier because to the user the grid sets to page 1 then loads the correct page.
So, my question is: is there a better way to reload a source and reset the grid to first page?
`function executeSearch(srchURL){
var source =
{
datatype: “json”,
url: srchURL,
root: ‘items’,
cache:false,
pagenum:0,
pagesize:10,
downloadComplete: function (data,status) {
source.totalrecords = data.fields.records;
}
}
var dataAdapter = new $.jqx.dataAdapter(source)
//set up the grid
$(“#results_grid”).jqxGrid({source:dataAdapter});
$(“#results_grid”).jqxGrid(‘gotopage’, 0);