jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxGrid Initial Sorting and Page number
This topic contains 3 replies, has 2 voices, and was last updated by wavetrex 10 years, 3 months ago.
-
Author
-
Hi !
The question is simple: Is there a way to specify INITIAL sorting and page number for the grid ?
I know they can be set later through the API, but in our application we use virtualmode and the grid load is quite heavy on the server.
The grid needs to START with certain parameters, yet apparently there are no options to define which column should be the sorting column, which page is the current page (so when the user goes back to the webpage containing the grid he would see directly page 5 for example, and not page 1 every time)Please don’t recommend the “gotopage” function. That means the application would have to wait to load page 1, then load page 5 in another server call, that’s not right.
My guess is that it has something to do with “autoloadstate” but damn, that ability is SO rigid !
How exactly can I tell it what to load ? I don’t want to load the previous state, I want it to load in a certain way.—
Wouldn’t it be much simpler if there was a “Behavior” parameter named “startpage” with value … a number ? Or a “startsort” parameter with column dataField and direction ?Thanks in advance,
W.p.s.
Enterprise customer here – I have the source code but it’s huge and could not figure it out myself in a reasonable amount of time. I hope there is a simpler solution than going through all that code and changing it myself…Hmz… autoloadstate seems broken in virtual mode.
It attempts to load the last used page ( this.dataview.pagenum = data.pagenum; ) but doesn’t send the parameter to the server “pagenum: 0”, and also is attempting to access rows bigger than “0 to pagesize” in the records array, however the dataAdapter doesn’t contain the correct page number and is loading all results into rows with UID’s 0,1,2… instead of 50,51,52 (or whatever is the uid for the pages bigger than 0)
It does work when the pager changes pagenum ( this._raiseEvent(9, { pagenum: pagenum, oldpagenum: oldpagenum, pagesize: this.dataview.pagesize }); ), but not on autoloadstate
… maybe I can fix this myself in the source …Hi wavetrex,
This is community, not support forum. If you’re asking for support from our Team, write to support@jqwidgets.com. We already have Online Demo which shows how to set the Initial Page of a Grid: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/initialpage.htm?arctic. May be you’ve missed it.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Ah, it needs to be put in the dataAdapter, not in the grid itself.
Yes, that works, thanks !“autoloadstate” however still doesn’t, unless I check the localStorage() myself before initializing the dataAdapter and Grid and putting that page number into the dataAdapter…. well, at least there is a solution, even if it’s not very straightforward.
I will write to support for more detailed questions.
Thank you !—
Edit: Apparently the same way goes for initial Sorting, it needs to be put in the dataAdapter.
Much more clear now thanks, I’ll review all the demos. -
AuthorPosts
You must be logged in to reply to this topic.