SMART datagrid v.1 > Classes > TreeDataSet

Back  Forward

DataLudi.TreeDataSet.appendJsonRows  method

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. 

function appendJsonRows (parent: TreeDataRow, rows: Array, rowsProp: String, childRowsProp: String, currency: Boolean);
Returns
Void
Parameters
parent - TreeDataRow. required.
rows - Array. required.
rowsProp - String. required.
childRowsProp - String. required.
currency - Boolean. required.
Code -1
    // It is the same as below call.
    ds.insertJsonRows(parent, parent.count(), rows, rowsProp, childRowsProp, currency);
Code -2
    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);
    }
See Also
insertJsonRows
setRows
appendDataRows
appendXmlRows
Examples
Append Tree Data
Load Tree Data
Tree Data Set