SMART datagrid v.1 > Classes > TreeDataSet
It creates JSON array which contains properties corresponding to data set fields and can contain the array of child objects as specified property name as tree data rows, and adds to the end of parent row specified by parent.
In order to insert in the middle location, it will use insertJsonRows. Please refer to setJsonRows about the way of organizing the tree by using parameters.
// It is the same as below call.
ds.insertJsonRows(parent, parent.count(), rows, rowsProp, childRowsProp, currency);
var rows = [{
loan_number: 'IBRD00010',
country: 'Spain',
interest_rate: 4.25,
currency: 'USD',
...
rows: [{
loan_number: 'IBRD00030',
country: 'Denmark',
...
}, {
loan_number: 'IBRD00040',
country: 'Luxembourg',
...
}]
}];
var row = tree.focusedDataRow();
if (row) {
ds.appendJsonRows(row, rows, "", "rows");
tree.expand(tree.focusedRow());
row = row.getChild(row.count() - 1);
row = tree.getRowOfDataRow(row);
tree.expand(row, true);
tree.setFocusedRow(row);
}