Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added list.visibleItems that returns all visible items

  • Loading branch information...
commit 64a89801a8619282e274a31019a9511fd3165079 1 parent 9c4fe31
Jonny Strömberg authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/list.js
9 src/list.js
View
@@ -47,7 +47,8 @@ var List = function(id, options, values) {
this.listContainer = document.getElementById(id);
this.items = [];
-
+ this.visibleItems = []; // These are the items currently visible
+ this.matchingItems = []; // These are the items currently matching filters and search, regadlessof visible count
this.searched = false;
this.filtered = false;
@@ -358,7 +359,7 @@ var List = function(id, options, values) {
updateVisible();
}
lastSearch = searchString;
- return matching;
+ return self.visibleItem;
};
/*
@@ -385,7 +386,7 @@ var List = function(id, options, values) {
}
}
updateVisible();
- return matching;
+ return self.visibleItem;
};
/*
@@ -422,6 +423,7 @@ var List = function(id, options, values) {
var updateVisible = function() {
var is = self.items;
+ self.visibleItems = [];
templater.clear();
var numShown = 0;
for (var i = 0, il = is.length; i < il && numShown < self.maxVisibleItemsCount; i++) {
@@ -433,6 +435,7 @@ var List = function(id, options, values) {
) {
is[i].show();
numShown++;
+ self.visibleItems.push(is[i]);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.