Search
GridModel.addRow Method
See Also
 






Adds a row to the backing store.

Namespace: MindFusion.DataViews
File: GridModel.js

 Syntax

JavaScript  Copy Code

function addRow ([rowData, [index]])

 Parameters

rowData
Optional.

Object. The values to add.

index
Optional.

Number. The index at which to insert the data.

 Return Value

Number. index The index of the new row.

 Example

The following code creates a Grid and inserts an array with data for one grid row at the first position:

JavaScript  Copy Code

var dv = MindFusion.DataViews;

// create the grid columns
var columns = [];

var column1 = new dv.GridColumn("index");
column1.dataType = dv.IntegerType;
column1.editable = false;
column1.caption = "#";
columns.push(column1);

var column2 = new dv.GridColumn("name");
column2.dataType = dv.StringType;
column2.caption = "Name";
columns.push(column2);

var column3 = new dv.GridColumn("winnings");
column3.dataType = dv.CurrencyType;
column3.caption = "Winnings";
columns.push(column3);

var column4 = new dv.GridColumn("registered");
column4.dataType = dv.DateType;
column4.caption = "Registered";
column4.metaData.set("customEditor", {
    "autoComplete": true,
    "allowEmptyInput": true
});
columns.push(column4);

// create the grid control
var grid = new dv.Grid(document.getElementById("grid"));
grid.theme = "blue";
// set the model
grid.model = new dv.ArrayModel(participants, columns, "index");

var dataList = [0, "Colorado Eagles", "12", new Date()];

 See Also