SMART datagrid v.1 > Classes > TreeDataSet

Back  Forward

DataLudi.TreeDataSet.insertJsonRows  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 insert in index location of parent row specified by parent

In order to append to the end of parent row, it will use appendJsonRows. Please refer to setJsonRows about the way of organizing the tree by using parameters. 

function insertJsonRows (parent: TreeDataRow, index: Integer, rows: Array, rowsProp: String, childRowsProp: String, currency: Boolean);
Returns
Void
Parameters
parent - TreeDataRow. required.
index - Integer. required.
rows - Array. required.
rowsProp - String. required.
childRowsProp - String. required.
currency - Boolean. required.
Code -1
    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 = treeMain.focusedDataRow();
    if (row) {
        var p = row.parent();
        dsMain.insertJsonRows(p, row.index(), rows, "", "rows");
    }
See Also
insertDataRows
setRows
appendDataRows
appendXmlRows
Examples
Append Tree Data
Load Tree Data
Tree Data Set