SMART datagrid v.1 > Classes > TreeDataSet
DataLudi.TreeDataSet.getRowsProps method
It returns the value of rows which have been specified by rows as the array of JSON object of which field names specified by props are property.
function getRowsProps (rows: [Integer|TreeDataRow], props: [String], emptyValue: *, all: Boolean): [Object];
- Returns
- [Object]
- Parameters
- rows - [Integer|TreeDataRow]. required.
The array of 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.
- all - Boolean. Defaults to false.
If it is true, when the item of rows does not specify a valid data row, it will contain null in the returned array.
- Note
- Like other methods, you should not update Date object which is returned from DATETIME field.
Code -1
var rows = tree.getSelectedDataRows();
var objs = ds.getRowsProps(rows, ['company', 'qty']);
console.log(objs);
Code -2
var rows = tree.getSelectedDataRows();
// Replace the value of undefined field with 0.
var objs = ds.getRowsProps(rows, ['company', 'qty'], 0);
console.log(objs);
Code -3
var rows = tree.getSelectedDataRows();
// Replace the value of undefined fields with the corresponding property value of JSON object.
var objs = ds.getRowsProps(rows, ['company', 'qty'], {
name: '',
qty: 0
});
console.log(objs);
- See Also
- getRowObjects
- getRowProps
- getRowObject
- Examples
- Tree Rows