Search
Grid.addRow Method
See Also
 






Adds a row.

Namespace: MindFusion.DataViews
File: Grid.js

 Syntax

JavaScript  Copy Code

function addRow (rowData)

 Parameters

rowData

Object. The values to add.

 Example

The following code handles the click event of an HTML button and adds a new row to a Grid instance. The index of the grid is incremented with one from the max index of the current data:

JavaScript  Copy Code

function onAddClick(sender)
{
    grid.allowEdit = true;
    grid.allowCellSelect = true;

    var data = grid.model.getRowData(grid.model.rowCount);
    var maxIndex = grid.model.getMaxKey();
    data.index = ++maxIndex;

    grid.addRow(data).then((newRow) =>
    {
        editRow = newRow;
        grid.refreshRows(newRow);
     
    });

 See Also