SMART datagrid v.1 > Classes > TreeDataSet

[ grids ver.1.3.8]   Back  Forward

DataLudi.TreeDataSet.getRowObject  method

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

function getRowObject (row: Integer|TreeDataRow, emptyValue: *): Object;
Returns
Object
Parameters
row - Integer|TreeDataRow. required.
The data row Object or row ID which will get the value.
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.getRowObject(row.dataRow());
        row && console.log(row);
    }
Code -2
    var row = tree.focusedRow();
    if (row) {
        // Replace the value of undefined field with 0.
        row = ds.getRowObject(row.dataRow(), 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.getRowObject(row.dataRow(), {
            name: '',
            qty: 0
        });
        row && console.log(row);
    }
See Also
getRowProps
getRowObjects
getRowsProps
TreeRow.dataRow
Examples
Tree Rows