SMART datagrid v.1 > Classes > GridDataSet

[ grids ver.1.3.8]   Back  Forward

DataLudi.GridDataSet.getRowsProps  method

Return the value of fields corresponding to the properties specified in props among the values of data rows contained in the specified range as array. 

function getRowsProps (startRow: Integer|[Integer], count: Integer, props: [String], emptyValue: *): [Object];
Returns
[Object]
Parameters
startRow - Integer|[Integer]. required.
It gets rows as much as count parameter from the ones which have been specified in this property. If do not specify, it will get from the first row.
If specify an array in which contains row numbers, it will return the object of specified rows. In this case, it will ignore count parameter.
count - Integer. required.
The number of rows which will be imported. If do not specify or it is a value less than 0, it will get from startRow row to the last row.
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 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 rows = ds.getRowsProps(['company', 'qty'], 0, 100, 0);
    for (var i = 0; i < rows.length; i++) {
        var row = rows[i];
        for (var c in row) {
            console.log(row[c]);
        }
    }
Code -2
    // Get all rows.
    var rows = ds.getRowsProps(['company', 'qty']);
    for (var i = 0; i < rows.length; i++) {
        var row = rows[i];
        ...
    }
Code -3
    // Transfer row number list to the first parameter.
    var rows = ds.getRowsProps(['company', 'qty'], [0, 1, 2, 3], null, {
        company: 'n/a',
        qty: 0
    });
    for (var i = 0; i < rows.length; i++) {
        var row = rows[i];
        ...
    }
See Also
getRowObjects
getRowProps
getRowObject
Examples
Grid Data Set Rows