mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
[Search] Not case sensitive
Search is no longer case sensitive.
This commit is contained in:
@ -88,13 +88,20 @@ define(function () {
|
|||||||
console.log('search called, with term ', term);
|
console.log('search called, with term ', term);
|
||||||
var searchResults = [],
|
var searchResults = [],
|
||||||
itemsLength,
|
itemsLength,
|
||||||
|
itemName,
|
||||||
i;
|
i;
|
||||||
|
// Make not case sensitive
|
||||||
|
if (term) {
|
||||||
|
term = term.toLocaleLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
// refresh items list
|
// refresh items list
|
||||||
return listify().then( function () {
|
return listify().then( function () {
|
||||||
itemsLength = $scope.items.length; // Slight time optimization
|
itemsLength = $scope.items.length; // Slight time optimization
|
||||||
for (i = 0; i < itemsLength; i += 1) {
|
for (i = 0; i < itemsLength; i += 1) {
|
||||||
console.log('items[', i, '].getModel', $scope.items[i].getModel());
|
itemName = $scope.items[i].getModel().name;
|
||||||
if ($scope.items[i].getModel().name.includes(term)) {
|
console.log('items[', i, '] name', itemName);
|
||||||
|
if (itemName.toLocaleLowerCase().includes(term)) {
|
||||||
searchResults.push($scope.items[i]);
|
searchResults.push($scope.items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user