RealGrid2 API
Interface
SearchCellOptions

SearchCellOptions

Flexible configuration model for cell search

Signature:

export interface SearchCellOptions

Remarks

Used in GridBase.searchCell().

Example

function searchCellHandler() {
     let value = "PR20012392"
     let fields = [ "RequestType", "ServiceCode" ];
     let startFieldIndex = fields.indexOf(grid.getCurrent().fieldName) + 1;
     let options = {
          fields : fields,
          value : value,
          startIndex: grid.getCurrent().itemIndex,
          startFieldIndex : startFieldIndex,
          wrap : true,
          caseSensitive : false;
          partialMatch : true
     }
     let index = grid.searchCell(options);
     grid.setCurrent(index);
}

Events

PropertyTypeDescription
compareCallbackCompareCallbackCallbacks for custom conditions

Properties

PropertyTypeDescription
caseSensitivebooleanWhether to search case sensitively
columnsstring[]Array of columns specified when the order of fields and columns is different
fieldsstring[]List of fields to search
parentIdnumberIt can only be used in the row-specific number of the parent tree LocalTreeDataProvider.
partialMatchbooleanWhether to search also for inclusion
reversebooleanReverse Search
selectbooleanWhether or not to select the searched row
startFieldIndexnumberIndex of the field in the fields array to start searching from
startIndexnumberSearch start row
valuestringSpecified search condition value
wrapbooleanIf there are no corresponding rows until the last row, whether to search again from the first row

Events Desc

compareCallback

Callbacks for custom conditions

Type - CompareCallback

Example:

const f = function(v1, v2, sensitive, partialMatch) {
 if (v1 === v2) {
 return true;
 }
 let s1 = String(v1);
 let s2 = v2 == null ? undefined : String(v2);
 if (!s1 && !s2) {
 return true;
 }
 if (!s1 || !s2) {
 return false;
 }
 if (!caseSensitive) {
 s1 = s1.toLowerCase();
 s2 = s2.toLowerCase();
 }
 if (partialMatch) {
  return s2.indexOf(s1) >= 0;
 } else {
  return s1 == s2;
 }
}
 
let options = {
 fields : fields,
 value : value,
 compareCallback: f
}
 
let index = grid.searchCell(options);

Properties Desc

caseSensitive

Whether to search case sensitively

Type - boolean


columns

Arrangement of columns specified when the order of fields and columns is different

Type - string[]

Remarks:

The search is performed in the order specified here. When using this property, SearchCellOptions.fields is not used.


fields

List of fields to search

Type - string[]

Remarks:

Can be specified by field name or field index


parentId

It can only be used in the row-specific number of the parent tree LocalTreeDataProvider.

Type - number


partialMatch

Whether to also search for inclusions

Type - boolean


reverse

Reverse Search

Type - boolean

Remarks:

Searches in reverse order based on startFieldIndex, and if not found, searches the row above startIndex. If startIndex is not specified, the search starts from the last row.


select

Whether to select searched rows

Type - boolean

Remarks:

If specified as true, the searched row will be selected if it exists, and if it is outside the currently displayed range, it will be scrolled to be displayed.


startFieldIndex

Index of the field in the fields array to start searching from

Type - number

Remarks:

let fields = ["a", "b", "c", "d"]; If const startFieldIndex = 2, the search starts from the "c" field.


startIndex

Search start row

Type - number


value

Specified search condition value

Type - string


wrap

If there are no corresponding rows until the last row, whether to search again from the first row.

Type - boolean