RealGrid2 API
Interface
SearchOptions

SearchOptions

Flexible configuration information model for row retrieval

Signature:

export interface SearchOptions

Remarks

Used in GridBase.searchItem().

When used in LocalDataProvider.searchDataRow(), LocalTreeDataProvider.searchDataRow(), filtered or row grouped In this case, hidden rows are not found.

Example

function searchItemHandler() {
     let values = ["PR20012392", "QF24212112"]
     let fields = [ "RequestType", "ServiceCode" ];
     let startFieldIndex = fields.indexOf(grid.getCurrent().fieldName) + 1;
     let options = {
          fields : fields,
          values: values,
          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
allFieldsbooleanWhether to search all fields that meet the conditions
caseSensitivebooleanWhether to search case sensitively
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
reversebooleanSearch in reverse order.
selectbooleanWhether to focus the searched row
startIndexnumberSearch start row
valuesstring[]Search condition values arranged in the order corresponding to each field specified in fields
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,
 values : values,
 compareCallback: f
}
 
let index = grid.searchItem(options);

Properties Desc

allFields

Whether to search all fields that meet the conditions

Type - boolean

Remarks:

If false, the search ends if a matching field is found among the specified fields.


caseSensitive

Whether to search case sensitively

Type - boolean


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

Search in reverse order.

Type - boolean

Remarks:

If reverse is true, the above row is searched based on startIndex.


select

Whether the searched row is focused or not

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.

Can only be used in GridBase.searchItem().


startIndex

Search start row

Type - number


values

Search condition values arranged in the order corresponding to each field specified in fields.

Type - string[]


wrap

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

Type - boolean