jQuery UI Widgets › Forums › Grid › How to go to a page
This topic contains 4 replies, has 2 voices, and was last updated by antonomase 11 years, 7 months ago.
-
AuthorHow to go to a page Posts
-
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 gridMy 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 ?
error
Hi antonomase,
Please, take a look at the implementation of this sample: serverfiltering_paging_and_sorting.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi 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.
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 -
AuthorPosts
You must be logged in to reply to this topic.