attachEvent
attaches the handler to an inner event of the component
function attachEvent( // the event name, case-insensitive type: string, // the function object or name functor: function, // optional, the event id id?: string): void
Example
Section titled “Example”dgrid.attachEvent("onAfterLoad",function(){ this.select(2);});
also check the next samples:
Details
Section titled “Details”How the handler is provided
Section titled “How the handler is provided”You can use the method with an inline function or provide just the global function reference. In the second case, be sure that the function is visible from the calling point.
function doTask(){ ... };dgrid.attachEvent("onBeforeLoad", doTask); // uses the reference
The handler id
Section titled “The handler id”The last parameter allows you to define the id of the attached handler. If it was not specified, some unique value will be assigned as the id. The only purpose of such id - detaching the handler from an event (in most cases you don’t need to care about the handler id).
Handler function parameters
Section titled “Handler function parameters”Check the related documentation to get the full list of parameters. The amount and meaning will vary for different events.
The value which is returned by an event can change behavior of component. Returning true or nothing will be considered as the positive signal, while returning false will be considered as a signal to stop the current activity.
dgrid.attachEvent("onBeforeSelect", function(id){ if (id == 123) return false; // blocks selection of a specific element});
See also
Section titled “See also”Articles
API