User Guide

290 DataGrid component (Flash Professional only)
Usage
listenerObject = new Object();
listenerObject.headerRelease = function(eventObject){
// Insert your code here.
}
myDataGridInstance.addEventListener("headerRelease", listenerObject)
Description
Event; broadcast to all registered listeners when a column header has been released. You can
use this event with the
DataGridColumn.sortOnHeaderRelease property to prevent
automatic sorting and to let you sort as you like.
Version 2 components use a dispatcher/listener event model. When the DataGrid component
dispatches a
headerRelease event, the event is handled by a function (also called a handler)
that is attached to a listener object (
listenerObject) that you create. You call the
addEventListener() method and pass it the name of the handler as a parameter.
When the event is triggered, it automatically passes an event object (
eventObject) to the
handler. Each event object has properties that contain information about the event. You can
use these properties to write code that handles the event. The
DataGrid.headerRelease
events event object has two additional properties:
columnIndex A number that indicates the index of the target column.
type The string "headerRelease".
For more information, see “EventDispatcher class” on page 499.
Example
In the following example, a handler called myListener is defined and passed to
grid.addEventListener() as the second parameter. The event object is captured by the
headerRelease handler in the eventObject parameter. When the headerRelease event is
broadcast, a
trace statement is sent to the Output panel.
var myListener = new Object();
myListener.headerRelease = function(event) {
trace("column " + event.columnIndex + " header was pressed");
};
grid.addEventListener("headerRelease", myListener);