SMART datagrid v.1 > Classes > GridDataSet

[ grids ver.1.3.8]   Back  Forward

DataLudi.GridDataSet.filterRows  method

Return the expression specified in filter parameter or the index of data rows matching callback function as array. 

If specify by callback, it will transfer the parameter as below, and if it is the row included in result, it should return true

function (ds:GridDataSet, row, count): Boolean;

row is the number of data row which is under review now, and count is the number of rows which have been added up to now. 

In the table below, it has listed the variable list which can be used in expression. 

function filterRows (filter: String|Function, maxCount: Integer): [Integer];
Returns
[Integer]
Parameters
filter - String|Function. required.
maxCount - Integer. Defaults to -1.
The maximum number of rows which will be contained in the returned array. If do not specify or it is a value less than 0, it will return all corresponding rows.
Table-1  expression variables
VariableExplanation
'valuesGet the value of each field to field name or index.
'row'The index of data row of being calculated.
Code -1
    // The rows of which company name starts with 'a' and quantity is greater than 100.
    var rows = ds.filterRows(function (ds, row, count) {
        return ds.getValue(row, 'country').indexOf('a') == 0 && ds.getValue(row, 'qty') > 100;
    });
    rows = grid.getRowsOfDataIndices(rows);
    grid.checkAll(false);
    grid.checkRows(rows);
Code -2
    // Get the rows of which quantity is greater than 100 up to 10.
    var rows = ds.filterRows("values['qty'] > 100", 10);
    rows = grid.getRowsOfDataIndices(rows);
    grid.checkAll(false);
    grid.checkRows(rows);
See Also
findRows
findRow
Examples
Grid Data Set Rows