Raised before a new row is created.
Namespace: MindFusion.DataViews
File: Grid.js
JavaScript Copy Code |
---|
EventDispatcher rowCreating |
The event handler method receives the following arguments:
sender
A Grid instance, which is the source of the event. This object will be passed to the handler function as the first argument.
args
A RowModifyingEventArgs instance, which contains event data. This object will be passed to the handler function as the second argument.
The following code handles the rowCreating event of a Grid instance. It uses the rowData property of the RowModifyingEventArgs class to increment the index of rows when a new row is added:
JavaScript Copy Code |
---|
// increment index when a new row is added grid.rowCreating.addEventListener((sender, args) => { var maxIndex = sender.model.getMaxKey(); args.rowData["index"] = ++maxIndex; }); |