Search
ArrayModel Class
See Also
 






Represents a grid model, that uses an array of objects as a backing store.

Namespace: MindFusion.DataViews
File: ArrayModel.js

 Syntax

JavaScript  Copy Code

// class
ArrayModel.prototype = {}

 Example

The following code creates a new Grid using an HTML <div> element with an id "grid". It creates a new ArrayModel with values from a JavaScript array called "participants". A list with columns is created and provided as the second parameter in the constructor. The key field is "index":

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);

// 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");

 Inheritance Hierarchy

MindFusion.DataViews.ArrayModel

 See Also