Javascript Actions

Description

Javascript Actions enable you to call Action Javascript anywhere you can use JavaScript in the Grid Component.

 Javascript Actions Property

Defining Javascript Actions is similar to defining Javascript Functions for your Grid Component, except that you can use the Action Javascript builder to write the Javascript code rather than hand-coding your function. The Actions that you define can be called by various event handlers in the Grid Component.

Running an action is done by calling the .runAction() method of the Grid Component. For example:

'Calling an action:
        {grid.object}.runAction('myAction');
Action names must be unique. Action names are also case-sensitive.

Some actions that you define using Action Javascript need to know what object invoked the action. For example, if you define an action that opens a window and you want the window positioned relative to the button that invokes the action, a reference object is required.

In order for the opens a window action to work, the {grid.object}.runAction() method needs a reference to the invoking object. This is done by passing a pointer to the object as the second parameter to the .runAction() method.

The second argument is typically this, but it could be a pointer to any element on the page. For example:

var ele = $('ID_OF_SOME_ELEMENT');
{grid.object}.runAction('myAction',ele);

If you do not do this, you will get a JavaScript error when the component tries to open the window relative to the button that invoked the action.

See Also