SMART datagrid v.1 > Classes > GridDataSet

[ grids ver.1.3.8]   Back  Forward

DataLudi.GridDataSet.findRows  method

Find and return the fields which are transferred by parameter fields and values list and the data rows which is corresponding to the value of each field. 

If no corresponding rows, it will return null or empty array. Each item of fields can be fieldName or index

function findRows (fields: [Integer|String], values: [*], strict: Boolean, maxCount: Integer): [Integer];
Returns
[Integer]
Parameters
fields - [Integer|String]. required.
values - [*]. required.
strict - Boolean. Defaults to false.
If it is true, it will compare with equalValues, and if it is false, it will compare with sameValues.
maxCount - Integer. Defaults to -1.
The maximum number of returned data rows. If do not specify or it is a value less than 0, it will return all found rows.
Code -1
    $('#searchRows').click(function () {
        var fields = ['customer_id', 'product_id'];
        var values = ['cust01', 'prod01'];
        var rows = ds.findRows(fields, values, false);

        if (rows && rows.length > 0) {
            rows = grid.getRowsOfDataIndices(rows);
            grid.checkAll(false);
            grid.checkRows(rows, true);
        }
    });
See Also
findRow
filterRows
Examples
Grid Data Set Rows