Skip to main content

data

Optional. Specifies an array of data objects to set into the grid

data?: object[];

Example

const dataset = [
{
"country": "China",
"population": "1415045928",
"yearlyChange": "0.0039",
"netChange": "5528531",
"id": "1"
},
{
"country": "India",
"population": "1354051854",
"yearlyChange": "0.0111",
"netChange": "14871727",
"id": "2"
},
// more columns
];

const grid = new dhx.Grid("grid_container", {
columns: [
// columns config
],
data: dataset
});

Related samples:

  1. Starting with v7.1, you can specify the height for the necessary row of data via setting the number value to the height option when defining the data set:
const dataset = [
{
"country": "China",
"population": "1415045928",
"height": 80,
"id": "1"
},
{
"country": "India",
"population": "1354051854",
"id": "2",
}
];

Related sample: Grid. Row height

note

The height option has a higher priority than the autoHeight:true configuration property of Grid.
Thus, autoHeight:true will be ignored for the cell that the height option is defined to.

  1. Starting with v7.1, it is possible to use the Date() object when specifying data for the "Date" column:
const dataset = [
{
"country": "China",
"date": new Date()
},
{
"country": "India",
"date": new Date(2010, 02, 10)
}
];

Related sample: Grid. Date column and support of the Date() object