mirror of
https://github.com/nasa/openmct.git
synced 2024-12-31 10:26:57 +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
|
// Search through items for items which contain the search term
|
||||||
// in the title
|
// in the title
|
||||||
function search(term) {
|
function search(term) {
|
||||||
console.log('search called');
|
console.log('search called, with term ', term);
|
||||||
console.log('search term ', term);
|
|
||||||
var searchResults = [],
|
var searchResults = [],
|
||||||
itemsLength,
|
itemsLength,
|
||||||
i;
|
i;
|
||||||
// refresh items list
|
// refresh items list
|
||||||
listify();
|
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());
|
||||||
console.log('items[', i, '].getModel', $scope.items[i].getModel());
|
if ($scope.items[i].getModel().name.includes(term)) {
|
||||||
if ($scope.items[i].getModel().name.includes(term)) {
|
searchResults.push($scope.items[i]);
|
||||||
searchResults.push($scope.items[i]);
|
}
|
||||||
}
|
}
|
||||||
}
|
console.log('search results ', searchResults);
|
||||||
console.log('search results ', searchResults);
|
$scope.results = searchResults; // Somewhat redundant
|
||||||
$scope.results = searchResults; // Somewhat redundant
|
return searchResults;
|
||||||
return searchResults;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the search view is opened, call listify()
|
// When the search view is opened, call listify()
|
||||||
|
Loading…
Reference in New Issue
Block a user