Skip to content

Instantly share code, notes, and snippets.

@b1ff
Created August 29, 2013 17:54
Show Gist options
  • Save b1ff/6381251 to your computer and use it in GitHub Desktop.
Save b1ff/6381251 to your computer and use it in GitHub Desktop.
__patchItemsProperty: function(excludeIds) {
if (!ko.isObservable(excludeIds)) {
throw new Error('Expected exclude ids to be observable array');
};
var self = this;
self.__updateFilesVisiblity(excludeIds());
ko.computed(function() {
self.__updateFilesVisiblity(excludeIds());
});
},
__updateFilesVisiblity: function(excludeIds) {
this.items.each(function (file) {
var shouldExclude = _.contains(excludeIds, file.Id());
file.visible(!shouldExclude);
if (shouldExclude) {
file.selected(false);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment