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
Property | Type | Description |
---|---|---|
compareCallback | CompareCallback | Callbacks for custom conditions |
Properties
Property | Type | Description |
---|---|---|
allFields | boolean | Whether to search all fields that meet the conditions |
caseSensitive | boolean | Whether to search case sensitively |
fields | string[] | List of fields to search |
parentId | number | It can only be used in the row-specific number of the parent tree LocalTreeDataProvider. |
partialMatch | boolean | Whether to search also for inclusion |
reverse | boolean | Search in reverse order. |
select | boolean | Whether to focus the searched row |
startIndex | number | Search start row |
values | string[] | Search condition values arranged in the order corresponding to each field specified in fields |
wrap | boolean | If 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