Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott on Mar 17, 2008 05:29
open dhtmlx forum
Saving Sort Order beyon a Session

Hello,

Is it possible to save the Column Sizes and Column Order beyond a session. We have user who would like to save the order of his columns once and then have that order everytime he logs on.

Scott
Answer posted by Support on Mar 17, 2008 09:24
Which grid version do you use ?

The latest one provides API for saving  columns sizes  and  order in cookie.

Please, see sample http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/rows_columns_manipulations/pro_column_states_save.html.

Generally, you can get column width by getColWidth(ind) method:

var arr = [];
for (var i = 0; i < mygrid.getColumnCount(); i++){
    arr[arr.length] =  mygrid.getColWidth(i); 
}

To get columns order you can try to use getColIndexById method:

mygrid.setColumnIds("1,2,3,4,...")

var index_1 = mygrid.getColIndexById("1");
...