SMART datagrid v.1 > Classes > GridBase
DataLudi.GridBase.searchRow method
Return the number of first Grid Row which meets the conditions specified by parameters.
If no searched row, it will return -1.
function searchRow (fields: Array, values: Array, options: Object, startRow: Number, wrap: Boolean, select: Boolean): Number;
- Returns
- Number
- Parameters
- fields - Array.
It compares field values which have been specified here with values which have been specified in values.
Each field can specify field index or name, and if specify a value less than 0 or a wrong field name, it will be excluded from searching.
- values - Array.
It specifies values which will be used as search condition according to the number which has been specified in fields.
If specify as undefined or it is a number smaller than fields, it will be excluded from searching from this location.
- options - Object.
The search condition. It will be described in the table below.
- startRow - Number.
The number of row from which will start searching.
- wrap - Boolean.
If it is true, when there is no matching row by searching from startRow,
it will search again from the first row to the prior row of startRow.
- select - Boolean.
If found the matching row, it will select this row and scroll to display in grid.
Table-1 Search Row Options
Property | Default Value | Explanation |
---|
allFields | true | The value of all fields contained in fields parameter should match each value specified in values parameter. |
caseSensitive | false | If it is true, it will be case sensitive. |
partialMatch | false | If it is true and the value is contained as partial field value, it will be considered as correct. |
Code -1
var prevRow = -1;
$('#search').click(function () {
var val = $('#cond').val();
var options = { partialMatch: true };
var row = grid.searchRow(['name'], [val], options, prevRow + 1, true, true);
if (row >= 0) {
prevRow = row;
}
});
- See Also
- searchCell
- Examples
- Search Row
- Tree Search Row