SMART datagrid v.1 > Classes > TreeDataSet

Back  Forward

DataLudi.TreeDataSet.insertDataRows  method

It creates data rows from the array of arrays which contain tree information and have been sorted in data set field order and insert them in index location of parent

In order to append in the end of data set, it will use appendDataRows. Please refer to setRows about the way of organizing the tree by using parameters. 

function insertDataRows (parent: TreeDataRow, index: Integer, rows: Array, treeField: String, useTreeField: Boolean, needSorting: Boolean);
Returns
Void
Parameters
parent - TreeDataRow. required.
index - Integer. required.
rows - Array. required.
treeField - String. required.
useTreeField - Boolean. required.
needSorting - Boolean. required.
Code -1
    var rows = [
        [0, "1","IBRD00010","France","4.25","USD","P037383","250","000","001.00","11/01/1952","05/01/1977"],
        [1, "1.1","IBRD00020","Netherlands","4.25","USD","P037452","191","044","211.75","04/01/1952","10/01/1972"],
        [1, "1.2","IBRD00021","Netherlands","4.25","USD","P037452","3","955","788.25","04/01/1953","04/01/1954"],
        [2, "1.2.1","IBRD00030","Denmark","4.25","USD","P037362","40","000","000.00","02/01/1953","08/01/1972"],
        [3, "1.2.2","IBRD00040","Luxembourg","4.25","USD","P037451","12","000","000.00","07/15/1949","07/15/1972"]
    ];
    var row = treeMain.focusedDataRow();
    if (row) {
        var p = row.parent();
        // Do not use treeField and no need to sort since it has already been sorted.
        dsMain.insertDataRows(p, row.index(), rows, 1, false, false);
    }
See Also
insertJsonRows
setRows
appendJsonRows
appendXmlRows
Examples
Load Tree Data
Tree Data Set