Browse Source

Don't autosuggest items that are already in the list of selected items

develop
Sven Slootweg 9 years ago
parent
commit
09e7b98ed8
  1. 4
      public_html/static/js/script.js

4
public_html/static/js/script.js

@ -197,7 +197,9 @@ module.directive("searchList", function(){
if (scope.listQuery !== "")
{
scope.listItems = util.objectToArray(scope.source).filter(function(item){
return (item.key.toLowerCase().indexOf(scope.listQuery.toLowerCase()) !== -1 || item.value.toLowerCase().indexOf(scope.listQuery.toLowerCase()) !== -1);
var matches = (item.key.toLowerCase().indexOf(scope.listQuery.toLowerCase()) !== -1 || item.value.toLowerCase().indexOf(scope.listQuery.toLowerCase()) !== -1);
var selected = (scope.ngModelItems.filter(function(selected_item){ return item.key == selected_item.key; }).length > 0);
return matches && !selected;
}).sort(function(a, b){
index_a = a.value.indexOf(scope.listQuery);

Loading…
Cancel
Save