RealGrid2 Guide
Data Management
Search

Search

You can perform a row-level search on one or more fields. The search option allows you to search by “partial word”, “case sensitive” criteria, etc.

Setting search conditions

SearchOptions specifies conditions for finding a specific row among the rows currently displayed in the grid.

var value = document.getElementById('txtSearch').value;
var fields = dataProvider.getOrgFieldNames();
var startIndex = gridView.getCurrent().itemIndex;
var startFieldIndex = fields.indexOf(gridView.getCurrent().fieldName) + 1;
var wrap = document.querySelector('input[name="wrap"]:checked').value;
var caseSensitive = document.querySelector('input[name="case"]:checked').value;
var partialMatch = document.querySelector('input[name="partial"]:checked').value
 
var options = {
   fields : fields,
   value : value,
   startIndex : startIndex,
   startFieldIndex : startFieldIndex,
   wrap : wrap,
   caseSensitive : caseSensitive,
   partialMatch : partialMatch
};
 
var index = gridView.searchCell(options);
gridView.setCurrent(index);

Search

Use the searchCell function to find the first row corresponding to the values of the specified fields and return the row number.

var index = gridView.searchCell(options);

Move focus

Moves focus to the first row returned.

var index = gridView.searchCell(options);
gridView.setCurrent(index);
 
gridView.setFocus();