Search
Commands

A grid column can be cofigured as a command column by setting its dataType property to ColumnType and providing a list of commands in the column metaData. Commands are descendants of the Command static class and should specify their own unique commandName. The default HTML controller is a button input, and you can override the createControl method to customize it or return another controller of your choice.

The default event, that will trigger the command is click, and you can override the eventName property to change it. When the specified event is triggered, the rowCommand event of the grid control is raised. The name of the command, that raised the event is provided in the CommandEventArgs event arguments and you can define your custom actions depending on it.

Here is an example of a command showing an alert:

JavaScript  Copy Code

class AlertCommand extends dv.Command
{
    static get commandName() { return "Alert"; }
}

grid.rowCommand.addEventListener(function (sender, args)
{
 if (args.commandName == "Alert")
  alert("Command executed on row #" + args.row.toString());
});