:: Forum >>

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
Tuesday, August 3, 2004
Alternatively, can I read a column's width, period, without resorting to a messy cross-browser stylesheet parsing?
Larry Groebe
Wednesday, August 4, 2004
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)
Sunday, August 8, 2004
That's it exactly - now I can retain the widths after a refresh.

Thanks!
Larry Groebe
Monday, August 9, 2004
I'm trying something similar - how do you set the column widths when you refresh the page?
Friday, October 8, 2004
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
Tuesday, April 12, 2005
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
Thursday, November 10, 2005
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
Thursday, November 10, 2005
Use form_resize to capture the resize event
keano
Wednesday, April 26, 2006

This topic is archived.


Back to support forum

Forum search