Dynamic paging clears initial sorting params


#1

I created my own cookie based sorting saving. If there is an entry, I attach something like

&dhx_sort[2]=asc

to my connector url.

I use dynamic loading and bricks paging. Once I move forward to a page that triggers a new dynamic server request it clears that parameter, so that the result is unsorted (atleast not sorted as I want it to).

From initial URL:

conn.php?connector=true&dhx_colls=3,9&dhx_sort[4]=asc

… the URL changes to:

conn.php?connector=true&dhx_no_header=1&posStart=24&count=8&dhxr1542880957265=1

… which of course kicks my initial sorting preferences. :angry:

BUT: When sorting in the GUI by clicking the column headers the paging algorithms saves that kind of sorting and attaches the according sorting params automatically.

Question: How to savely load (and reload) data from server with stored client side preferences (that may change through sorting by user and should always keep that last sorting preferences).


#2

After the page changing right before the data request onDynXLS event is calling:
https://docs.dhtmlx.com/api__dhtmlxgrid_ondynxls_event.html
You may block that event adding “return false;” and call the data request manually right from that event.
e.g.:

grid.attachEvent("onDynXLS", function(start,count){
grid.load("conn.php?connector=true&dhx_no_header=1&posStart="+start+"&count="+count+"&dhx_sort[4]=asc")
return false;
});

#3

Thanks sematik! Meanwhile I solved it using my own Cookie based solution. Works well so far. :wink: