Reputation: 4490
I need to trap the manual resizing of a column width. Then store all the column widths into a cookie so that the next time the page is loaded the columns can be set according to the user preferences.
Is there a way to do that?
Upvotes: 1
Views: 764
Reputation: 4490
Couldn't figure out from the documentation what event was required:
myTable.subscribe("columnResizeEvent",
function(event){
var column = event.column;
var key = column.getKey();
var width = event.width;
createCookie("myTable.columns."+key+".width",width);
}
);
Where createCookie is a routine to write cookies. This approach allows the cookies to be read while the columns are being defined, but before the table is rendered:
for(var i in myColumnDefs){
var column = myColumnDefs[i];
var width=readCookie("myTable.columns."+
column.key+
".width");
if (width){
column.width = parseInt(width);
}
}
Upvotes: 2