SMART datagrid v.1 > Classes > TreeDataSet

[ grids ver.1.3.8]   Back  Forward

DataLudi.TreeDataSet.getRowProps  method

It returns the value of row which has been specified by row as JSON object of which field names specified by props are property. 

function getRowProps (row: Integer|TreeDataRow, props: [String], emptyValue: *): Object;
Returns
Object
Parameters
row - Integer|TreeDataRow. required.
The data row Object or row ID which will get the value.
props - [String]. required.
The array of property name which will be contained in the returned JSON object. It only contains properties which have been contained in this array. And, it will exclude when it is contained in this array but not a field name.
emptyValue - *.
The value which will replace the undefined field value. If specify the default data type value like String, it will be applied to all fields, and if specify JSON object, it will search and replace with the value of matching field name.
Note
Code -1
    var row = tree.focusedRow();
    if (row) {
        row = ds.getRowProps(row.dataRow(), ['company', 'qty']);
        row && console.log(row);
    }
Code -2
    var row = tree.focusedRow();
    if (row) {
        // Replace the value of undefined field with 0.
        row = ds.getRowProps(row.dataRow(), ['qty', 'amount'], 0);
        row && console.log(row);
    }
Code -3
    var row = tree.focusedRow();
    if (row) {
        // Replace the value of undefined fields with the corresponding property value of JSON object.
        row = ds.getRowProps(row.dataRow(), ['company', 'qty'], {
            company: 'n/a',
            qty: 0
        });
        row && console.log(row);
    }
See Also
getRowObject
getRowsProps
getRowObjects
Examples
Tree Rows