Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Emilie Meunier on May 05, 2009 07:02
open dhtmlx forum
loadSortingFromCookie server side

I used the smart rendering datagrid and I have a server side sorting. I would like to know if It's possible to use loadSortingFromCookie even if I used server side? This is my code and it does not save the order...
g_dgItem = new dhtmlXGridObject('products_grid');

g_dgItem.setImagePath("../../../class/dhtmlxgrid/codebase/imgs/");
g_dgItem.setHeader(",Nom,Ancien nom,Création, Modification");
g_dgItem.setInitWidths("30,200,180,80,90");
g_dgItem.setColAlign("left,left,left,left,left");
g_dgItem.enableTooltips("false,false,false,false,false");
g_dgItem.setColTypes("img,ed,ed,ed,ed");
g_dgItem.setColSorting("server,server,server,server,server");
g_dgItem.setColumnIds("-1,0,1,2,3");
g_dgItem.enableRowsHover(true,'grid_hover');
g_dgItem.enableColumnMove(true);

g_dgItem.init();
g_dgItem.setSkin("modern");
g_dgItem.enableSmartRendering(true);
g_strOrderBy = "orderby=0"+"&direct=ASC";
gridQString = "getGridRecords.asp?filtre="+g_strFiltre;//save query string to global variable (see step 5 for details)
g_dgItem.attachEvent("onXLS",function(){ this.entBox.style.cursor='wait'; });

g_dgItem.attachEvent("onGridReconstructed",setCounter);
g_dgItem.enableSortingSaving();
g_dgItem.loadXML( gridQString+(gridQString.indexOf("?")>=0?"&":"?")+"orderby=0"+"&direct=ASC", function(){
g_dgItem.setSortImgState(true,1,"ASC");});
g_dgItem.loadSortingFromCookie();

// Cette commande attend que le loadXML soit terminé et obtient la valeur de g_dgItem.getRowsNum() c'est-à-dire le
// nombre d'enregistrement du grid.
g_dgItem.attachEvent("onXLE",setCounter);
dhtmlxError.catchError("ALL", myErrorHandler);

g_dgItem.attachEvent("onBeforeSorting",sortGridOnServer);
g_dgItem.attachEvent("onRowDblClicked",onDblClick);
g_dgItem.attachEvent("onBeforeCMove",moveColumn);
Answer posted by dhxSupport on May 05, 2009 07:42
Unfortunately there is no way to save sorting state to cookies if you are using smart rendering mode.