SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.getFieldValues  method

Return the values of one field of all data rows as array. 

You can specify the row range by startRow and count parameters. If no row is contained in the range, it will return null

function getFieldValues (field: Integer|String, startRow: Integer, count: Integer): [*];
Returns
[*]
Parameters
field - Integer|String. required.
The field name or index. If specify a wrong value, it will throw an exception.
startRow - Integer. Defaults to 0.
count - Integer.
If do not specify, it will get the value of all rest rows.
Note
Code -1
    var rows = ds.getFieldValues('qty', 0, 100);
    var sum = 0;
    rows.forEach(function (v) {
        sum += v > 0 ? v : 0;
    });
    $('#sum')[0].value = sum;
See Also
getRows
getRowObjects
Examples
Grid Data Set Rows