Improve matcher example (see #4668)
This commit is contained in:
parent
d2655a89ba
commit
b61b7f4892
@ -22,6 +22,11 @@ function matchCustom(params, data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// Do not display the item if there is no 'text' property
|
||||
if (typeof data.text === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// `params.term` should be the term that is used for searching
|
||||
// `data.text` is the text that is displayed for the data object
|
||||
if (data.text.indexOf(params.term) > -1) {
|
||||
@ -64,6 +69,11 @@ function matchStart(params, data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
// Skip if there is no 'children' property
|
||||
if (typeof data.children === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// `data.children` contains the actual options that we are matching against
|
||||
var filteredChildren = [];
|
||||
$.each(data.children, function (idx, child) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user