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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

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

/*
Expand Down Expand Up @@ -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++) {
Expand All @@ -433,6 +435,7 @@ var List = function(id, options, values) {
) {
is[i].show();
numShown++;
self.visibleItems.push(is[i]);
}
}
}
Expand Down

0 comments on commit 64a8980

Please sign in to comment.