3.2.0

Capture column resize event?

I saw this discussed a few weeks ago, but am unclear on the resolution...

If I resize a column, can I javascriptly detect that change; so I can read all the new column widths and store them in a cookie for future reference?
Larry Groebe
August 3,
Alternatively, can I read a column's width, period, without resorting to a messy cross-browser stylesheet parsing?
Larry Groebe
August 4,
The following code will read the column widths from column headings elements:

window.onunload = function(){
    var i, widths = [], count = obj.getColumnProperty("count");
    for (i=0; i<count;i++){
        widths[i] = obj.getTemplate("top/item", i).element().offsetWidth;
    }
    alert(widths);
}
Alex (ActiveWidgets)
August 8,
That's it exactly - now I can retain the widths after a refresh.

Thanks!
Larry Groebe
August 9,
I'm trying something similar - how do you set the column widths when you refresh the page?
October 8,
I can't get the suggested code to work on my grid...

I have to admit, my knowledge of Javascript is not up to par. Where would be the best location to place this script in my document?

Any help would be greatly appreciated.

Daniel Szabolcs
April 12,
I needed to capture the column resize event immediately after the user resizes the column - NOT onunload. Here's the code for that.

var alertWidths = function()
{
    var i;
    var widths = [];
    var count = obj.getColumnProperty("count");
    for (i = 0; i < count; ++i)
    {
        widths[i] = obj.getTemplate("top/item", i).element().offsetWidth; 
    }
    alert(widths);
}
obj.setEvent("onmouseup", alertWidths);
Pete
November 10,
On second thought... that code runs when the onmouseup event fires. Which works, but has obvious problems in a large scale Web application. Does anyone know if there's a more specific event to attach to after the column resize event fires?

Thanks in advance for your help...
Pete
November 10,
Use form_resize to capture the resize event
keano
April 26,

This topic is archived.

See also:


Back to support forum