:: Forum >>

Column resize event please

Hi! I am trying to use the code I found here: http://www.activewidgets.com/javascript.forum.1743.8/capture-column-resize-event.html

to capture the column resize event so I can resize columns in other grids on the page. My first step is to get the sizes of all columns in the grid whose columns are being resized. But it bombs on the line I marked.

var alertWidths = function()
{
var i;
var widths = [];
var count = obj.getColumnProperty("count");
for (i = 0; i < count; ++i)
{
// BOMBS ON THE LINE BELOW:
widths[i] = obj.getTemplate("top/item", i).element().offsetWidth;
}
alert(widths);
}
The error is: 'undefined' is null or not an object

So I chose to Debug it in MS Visual Studio 2003 and it shows this function:

AW.dispatch = function(element, event){

var type = "_on" + (events[event.type] || event.type) + "Event";
var target = AW.object(element.id);
var obj = target;

while (obj._parent){
obj = obj._parent;
}

//**** HIGHLIGHT IS ON THE LINE BELOW:
return target[type].call(obj, event);
};
What am I doing wrong ? What are my other options? I need when I resize columns in one grid to propagate it to other grids.

Many thanks in advance,

Michael Z
Friday, August 10, 2007
You found a post for version 1.x , to apply the same for ver. 2.x just use:

widths[i] = obj.getHeaderTemplate(i).element().offsetWidth;
Carlos
Saturday, August 11, 2007
You can also use onColumnWidthChanged event -

grid.onColumnWidthChanged = function(width, index){...}

http://www.activewidgets.com/aw.ui.grid/column-width.html
Alex (ActiveWidgets)
Monday, August 13, 2007
Thank you Alex & Carlos. Your answers really helped. One question remains:

Since all grids on my page can have the onColumnWidthChanged event,
how do I stop this event from being raized while I resize all grids?
Is there a detachEvent call on a grid? I am going into an infinite loop.

Many thanks in advance,

Michael Z
Wednesday, August 15, 2007

This topic is archived.


Back to support forum

Forum search