3.2.0

Grid - Need additional action for header click

2/28/2012. For the Grid, I need one or more column headers to fire an additional individualized function when it is clicked. Ex. fooFn('theGrid-header-1-0'). I'd like to supply an individual function to each column heading (in addition to its sort functionality, not replacing or thwarting it). Cannot see in aw.js where to hook into this event - too abstracted for my brain. I inherited this project and have no prior experience with using aw.js, and not an OO coder by nature. AW ver 2.0.2. IE ver 8 & 9. Had tried to add the onclick attribute using JavaScript, and got JavaScript placed it correctly. However, even though present, this onclick event is blocked or otherwise not working.

//towards page bottom after grid object is in document
el = document.getElementById('theGrid-header-1-0');
el.onclick="fooFn('theGrid-header-1-0')";

TIA,

Sean
SeanH
February 28,
The code above does not add an event handler, just an attribute with the name 'onclick'. This attribute would be converted to an event handler on the parsing of the html markup, but not when you add it as node attribute. Instead you should use addEventListener/attachEvent methods.

AW provides you with a column index which you can use for the specific actions -

obj.onHeaderClicked = function(event, index){ 
alert("Header " + index + " clicked");
};


You can see more samples in /examples/quickref/grid.htm
Alex (ActiveWidgets)
February 29,
Excellent. Thanks so much!
SeanH
February 29,

This topic is archived.

See also:


Back to support forum