jQWidgets Forums

jQuery UI Widgets Forums Grid paging problem reloading grid with new data

This topic contains 1 reply, has 2 voices, and was last updated by  thesin18598 9 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • dougcurl
    Participant

    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);


    thesin18598
    Participant

    $(“#YourGrid”).jqxGrid(‘updatebounddata’);

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.