data
Optional. Specifies an array of data objects to set into the grid
data?: object[];
Example
const dataset = [
{
"name": "Argentina",
"native": "Argentina",
"phone": "54",
"continent": "SA",
"capital": "Buenos Aires"
},
{
"name": "American Samoa",
"native": "American Samoa",
"phone": "1684",
"continent": "OC",
"capital": "Pago Pago"
},
// more columns
];
const treegrid = new dhx.TreeGrid("treegrid_container", {
columns: [
// columns config
],
data: dataset
});
Related sample: TreeGrid. Initialization with config.data
1. Starting with v7.1, you can specify the height of the cell via setting the number value to the height option when defining the data set:
const dataset = [
{
"name": "Argentina",
"native": "Argentina",
"phone": "54",
"continent": "SA",
"capital": "Buenos Aires",
"height": 70
},
{
"name": "American Samoa",
"native": "American Samoa",
"phone": "1684",
"continent": "OC",
"capital": "Pago Pago"
},
];
Related sample: TreeGrid. Row height
note
The height option has a higher priority than the autoHeight:true configuration property of TreeGrid.
Thus, autoHeight:true will be ignored for the cell that the height option is defined to.
2. 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 samples: Treegrid. Date column and support of the Date() object