Skip to content

Commit

Permalink
Added list.visibleItems that returns all visible items
Browse files Browse the repository at this point in the history
  • Loading branch information
javve committed Jan 26, 2012
1 parent 9c4fe31 commit 64a8980
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/list.js
Expand Up @@ -47,7 +47,8 @@ var List = function(id, options, values) {


this.listContainer = document.getElementById(id); this.listContainer = document.getElementById(id);
this.items = []; 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.searched = false;
this.filtered = false; this.filtered = false;


Expand Down Expand Up @@ -358,7 +359,7 @@ var List = function(id, options, values) {
updateVisible(); updateVisible();
} }
lastSearch = searchString; lastSearch = searchString;
return matching; return self.visibleItem;
}; };


/* /*
Expand All @@ -385,7 +386,7 @@ var List = function(id, options, values) {
} }
} }
updateVisible(); updateVisible();
return matching; return self.visibleItem;
}; };


/* /*
Expand Down Expand Up @@ -422,6 +423,7 @@ var List = function(id, options, values) {


var updateVisible = function() { var updateVisible = function() {
var is = self.items; var is = self.items;
self.visibleItems = [];
templater.clear(); templater.clear();
var numShown = 0; var numShown = 0;
for (var i = 0, il = is.length; i < il && numShown < self.maxVisibleItemsCount; i++) { for (var i = 0, il = is.length; i < il && numShown < self.maxVisibleItemsCount; i++) {
Expand All @@ -433,6 +435,7 @@ var List = function(id, options, values) {
) { ) {
is[i].show(); is[i].show();
numShown++; numShown++;
self.visibleItems.push(is[i]);
} }
} }
} }
Expand Down

0 comments on commit 64a8980

Please sign in to comment.