Skip to content

Instantly share code, notes, and snippets.

@samdelagarza
Created February 25, 2011 18:31
Show Gist options
  • Save samdelagarza/844258 to your computer and use it in GitHub Desktop.
Save samdelagarza/844258 to your computer and use it in GitHub Desktop.
removeFacilitySpecificItemsFromGrid = function (facilityId) {
var
bindingStorageElement = $('#ProductNames'),
productCollection = $(bindingStorageElement).data('products'),
newSelectionsParent = {},
newSelections = [];
if (productCollection !== undefined) {
$.each(productCollection.Items, function (key, item) {
if (item.FacilityId !== facilityId.toString()) {
newSelections.push(item);
}
});
}
var product = _models.createContractProfile(_fieldsetContext);
productCollection = $(bindingStorageElement).data('products');
if (productCollection === undefined) {
productCollection = _models.createContractProfileCollection([product]);
}
newSelectionsParent.CriteriaType = getCriteriaType();
newSelectionsParent.Items = newSelections;
$(bindingStorageElement).data('products', newSelectionsParent);
_view.bindProductGrid(newSelectionsParent.Items);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment