Created
August 29, 2013 17:54
-
-
Save b1ff/6381251 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__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