3.2.0

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
August 10,
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
August 11,
You can also use onColumnWidthChanged event -

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

http://www.activewidgets.com/aw.ui.grid/column-width.html
Alex (ActiveWidgets)
August 13,
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
August 15,

This topic is archived.

See also:


Back to support forum