The user should include dhtmlxgrid_ssc.js file into the HTML in order to be able to manipulate with cookies.
The following method can be used for this purpose:
<script> grid.enableAutoSizeSaving(name,cookie_param); // automatic saving of columns sizes grid.enableAutoHiddenColumnsSaving(name,cookie_param); // automatic saving of columns state (hidden|shown) grid.enableAutoSaving(name,cookie_param); // automatic saving of all possible parameters grid.enableOrderSaving(name,cookie_param); // automatic saving of columns order grid.enableSortingSaving(name,cookie_param); // automatic saving of sorting state </script>
The parameters of all the above mentioned methods are the following:
There are several methods in dhtmlxGrid that are responsible for saving to cookies:
<script> grid.saveHiddenColumnsToCookie(name,cookie_param); // save columns state (hidden|shown) to cookies grid.saveOrderToCookie(name,cookie_param); // save sorting order to cookies grid.saveSortingToCookie(name,cookie_param); // save sorting to cookies grid.saveSizeToCookie(name,cookie_param); // save column width to cookies </script>
The parameters of all the above mentioned methods are the following:
There are also several script methods for loading from cookies:
<script> grid.loadHiddenColumnsFromCookie(name); // load columns state (hidden|shown) from cookies grid.loadOrderFromCookie(name); // load sorting order from cookies grid.loadSizeFromCookie(name); // load grid layout from cookies grid.loadSortingFromCookie(name); // load sorting order from cookies </script>
The parameter of all the above mentioned methods is name - optional, cookie name.
The method responsible for clearing cookie with grid configuration details is the following:
<script> grid.clearConfigCookie(name); </script>
The parameter of this method is name - optional, cookie name.