SMART datagrid v.1 > Classes > TreeDataSet

Back  Forward

DataLudi.TreeDataSet.appendJsonRows  method

将包含相当于数据组字段的属性并可以通过指定的属性名称而包含子对象的JSON数组创建为树数据行之后,将其添加到通过parent而指定的父行的最后。 

为插入在中间位置,将会使用insertJsonRows。 有关通过使用参数而构成树的方法,请参考setJsonRows。 

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
    // 如同下列调用。
    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
添加树数据
加载树数据
树数据组