Order columns with sorted values saved into cookies.


We are using professional grid with server side sorting, smart rendering and we are developing grid persistence and cookies.
Everything seems to work quite well and column order, column size and sorting is stored into a cookie.

The problem comes when we try to reorder a column that have been sorted previously.
If sorting value of this column are 3,asc and we are moving this column to the first position the sorting value does not refresh it’s value with 0,asc automatically as in your example of : http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/16_rows_columns_manipulations/07_pro_column_states_save.html

Column order are saved using enableOrderSaving(cookieName,expires) and column size with enableAutoSaving(cookieName, expires);
For loading this values loadOrderFromCookie(name) and loadSizeFromCookie(name) are used.

For sorting saving we have attach to onBeforeSorting this code:

grid+".attachEvent('onBeforeSorting', function(index,type,direction){" + grid + ".saveSortingValuesToCookie('"+ this.getCookieName()+ "','"+ this.getCookieExpires()+ "', index + ',' + direction); return SORT_EVENT("+grid+",__url('"+actionEventHandler+"'),index,type,direction); });"

Where sorting values are saved into a cookie.

For loading the sorting state from cookie we use:

"var res=loadSortingValuesFromCookie(" + grid + ",'" + this.getCookieName() + "');\n" + "if (res != '') {\n" + "var index=parseInt(res[0]);\n"+ "var direction = res[1];\n"+ grid+".reload (__url('"+actionInit+"')+'" + extraParms + "&' +"+ grid +".onSorting__GetParms(index,null,direction), GRID_HANDLER, null);\n" + grid+".setSortImgState(true,index,direction);\n"+ "}\n" + "else {\n" + grid+".reload(__url('"+actionInit+"')+'"+ extraParms + "&' , GRID_HANDLER, null);\n" + "}\n";

Could you give us any idea about what may be happening to get this issue?


What version of dhtmlxGrid are you using? Similar issue has been fixed at the latest version of dhtmlxGrid.