Hi,
I would like to get the width of my grid columns, as adjusted by a user, and persist them to a cookie so that I can restore them the next time a page is loaded. At the moment I'm having trouble finding exactly where the current grid column widths are located so that I could grab them on page unload and save into a cookie. Does anyone know where it is?
Thanks, Tim.

I found a solution to take
I found a solution to take the values direct from the DOM.
var columnNamesAndWidths = new Array();
var gridNode = dojo.byId(gridId);
if (gridNode == null) {
return;
}
dojo.query("th", gridNode).forEach(
function(column) {
columnNamesAndWidths.push(column.childNodes[0].data + "=" + column.style.width);
}
);
dojo.cookie("TapGridColumnWidth_" + gridName + ".cookie", columnNamesAndWidths.join(','), { expires: 90 });
}
Thanks
Nice work!
Thanks for this solution. I
Thanks for this solution. I could not get it to work exactly like you wrote it because I am not familiar with the dojo API. However here is a variation I wrote which achieves the same thing. Very useful!
function _gridGetColumnsWidth() { var l_gridNode = dojo.byId(_gridName); // get the DOM node var l_columnWidths = new Array(); var l_columns = l_gridNode.getElementsByTagName('th'); var l_col; for (l_col = 0; l_col < l_columns.length; l_col++) { // the column width will be in in pixels e.e. 78px // we need to remove the px value var l_width = parseInt(l_columns[l_col].style.width); l_columnWidths.push(l_width); } return l_columnWidths; }