mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 06:27:48 +00:00
[Search] Items list updating
The search results now updates the items list when called to make sure that it gets all of the recently added items.
This commit is contained in:
parent
efba0f0236
commit
b5756d2b99
@ -85,24 +85,23 @@ define(function () {
|
||||
// Search through items for items which contain the search term
|
||||
// in the title
|
||||
function search(term) {
|
||||
console.log('search called');
|
||||
console.log('search term ', term);
|
||||
console.log('search called, with term ', term);
|
||||
var searchResults = [],
|
||||
itemsLength,
|
||||
i;
|
||||
// refresh items list
|
||||
listify();
|
||||
itemsLength = $scope.items.length; // Slight time optimization
|
||||
|
||||
for (i = 0; i < itemsLength; i += 1) {
|
||||
console.log('items[', i, '].getModel', $scope.items[i].getModel());
|
||||
if ($scope.items[i].getModel().name.includes(term)) {
|
||||
searchResults.push($scope.items[i]);
|
||||
return listify().then( function () {
|
||||
itemsLength = $scope.items.length; // Slight time optimization
|
||||
for (i = 0; i < itemsLength; i += 1) {
|
||||
console.log('items[', i, '].getModel', $scope.items[i].getModel());
|
||||
if ($scope.items[i].getModel().name.includes(term)) {
|
||||
searchResults.push($scope.items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('search results ', searchResults);
|
||||
$scope.results = searchResults; // Somewhat redundant
|
||||
return searchResults;
|
||||
console.log('search results ', searchResults);
|
||||
$scope.results = searchResults; // Somewhat redundant
|
||||
return searchResults;
|
||||
});
|
||||
}
|
||||
|
||||
// When the search view is opened, call listify()
|
||||
|
Loading…
Reference in New Issue
Block a user