Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by chad on Nov 18, 2008 16:25
open dhtmlx forum
loadHiddenColumnsFromCookie()

I've got a web app where a user can hide/unhide columns and save their settings. When they logout and log back in i reload the grid and load the hidden columns from the cookie, works great. But if they close their browser and open it again the default columns are visible. here is my code:


        gridCurrent = new dhtmlXGridObject("gridCurrent");
gridCurrent.setImagePath("dhtmlx/imgs/");
gridCurrent.setEditable(true);
gridCurrent.setSkin("mt");

        gridCurrent.attachEvent("onResizeEnd",doOnResizeEnd);

gridCurrent.enableAutoHeight(true);
gridCurrent.enableMultiline(true);
gridCurrent.enableEditEvents(true, false, false);

gridCurrent.init();

        ...

gridCurrent.loadXML(URL,function(){

gridCurrent.loadHiddenColumnsFromCookie();
gridCurrent.loadSizeFromCookie();
     });
        ...


        There is also a button on the page that allows the user to save the hidden columns to a cookie:

        ...
        grid.saveHiddenColumnsToCookie();
    grid.saveSizeToCookie();
        ...
Answer posted by Support on Nov 19, 2008 03:01
By default cookies are session based, so the will expire after browser closing.
You can use second param of saveHiddenColumnsToCookie as
          grid.saveHiddenColumnsToCookie("name","expires=Fri, 31-Dec-2010 23:59:59 GMT");