SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.findRow  method

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

If do not exist, it will return -1. Each item of fields can be fieldName or index

function findRow (fields: [Integer|String], values: Array, strict: Boolean): Integer;
Returns
Integer
Parameters
fields - [Integer|String]. required.
values - Array. 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.
Code -1
    $('#search').click(function () {
        var fields = ['customer_id', 'product_id'];
        var values = ['cust01', 'prod01'];
        var row = ds.findRow(fields, values, false);

        if (row >= 0) {
            var idx = grid.focusedIndex();
            var idx.rowIndex = grid.getRowOfDataIndex(row).index();
            grid.setFocusedIndex(idx);
        }
    });
See Also
findRows
filterRows
equalValues
sameValues
Examples
Hello Grid
Grid Data Set Rows