jQuery UI Widgets Forums Grid How to go to a page

Tagged: ,

This topic contains 4 replies, has 2 voices, and was last updated by  antonomase 11 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • How to go to a page #15535

    antonomase
    Participant

    I want to use url params to filter, sort and go to a page in a grid
    eg : mypage.html?NAME=abcd&TOWN=new&sortby=TOWN&order=asc&page=3
    which filters on column NAME AND TOWN, sort on column TOWN with asc sorter and go to the third page of the grid

    My function is

    function filterUrlParams (jqxgrid, urlParams) {
    var sortcolumn = '';
    var sortorder = '';
    var pagenum = 1;
    $.each(urlParams, function(key, value) {
    switch (key) {
    case 'order':
    sortorder = value;
    break;
    case 'sortby':
    sortcolumn = value;
    break;
    case 'page':
    pagenum = value;
    break;
    default:
    var filtervalue = value;
    var filtercondition = 'contains';
    var filtergroup = new $.jqx.filter();
    var filter = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
    filtergroup.addfilter(1, filter);
    $(jqxgrid).jqxGrid('addfilter', key, filtergroup);
    break;
    }
    });
    $(jqxgrid).jqxGrid('applyfilters');
    $(jqxgrid).jqxGrid('sortby', sortcolumn, sortorder);
    $(jqxgrid).jqxGrid('gotopage', pagenum);
    }

    Applying filters is OK
    Sorting the rows is OK
    But the grid stays on the first page.

    What is wrong in my code ?

    How to go to a page #15540

    antonomase
    Participant

    error

    How to go to a page #15543

    Peter Stoev
    Keymaster

    Hi antonomase,

    Please, take a look at the implementation of this sample: serverfiltering_paging_and_sorting.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    How to go to a page #15544

    antonomase
    Participant

    Hi Peter,

    Thanks for your answer, but it is not what I want to do. I still have a website with SQL request with LIMIT.

    I just want to download all the datas in the jqxGrid and then apply filters, sorts and changing pages. If in the URL there is ?page=2, the second page must be automaticaly displayed and the user can go to page 1 or 3 without having to reload datas from server.

    My code works fine with filters and sorts in the URL, but this do not work with gotopage (or gotonextpage)

    $("#jqxgrid").jqxGrid(
    { width: ...
    ready: function () {
    $("#jqxgrid").jqxGrid('gotopage', 3);
    });

    if i put the gotopage on a click event after the display of datas, it’s OK. But on the ready event of the grid, it doesn’t work.

    How to go to a page #15560

    antonomase
    Participant

    Hi, the gotopage function must be called on the bindingcomplete event, not on the ready event.
    And the value argument must be parsed in integer

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

You must be logged in to reply to this topic.