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,
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;
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,
This topic is archived.