Skip to content

Instantly share code, notes, and snippets.

View samdelagarza's full-sized avatar

Sam De La Garza samdelagarza

View GitHub Profile
_.pluck(_productCollection.Items, "Id"), function (Id) {
return Id === product.Id;
})
_productCollection = {
CriteriaType: "Products",
Items: {
Facility: null,
FacilityId: null,
Name: "",
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()) {
removeContractProfileFromGrid = function (event) {
var
contractProfileId = $(event.currentTarget).parent().data('dataKey'),
contractProfileRecord = _contractProfileGridRecords.get(contractProfileId);
_contractProfileGridRecords.remove(contractProfileRecord);
},
_contracts = new _widgetCollections.Contracts();
_contractDropDown = new _widgetViews.contractDropDown({
collection: _contracts
});
And in a seperate file this is the collection definition:
Backbone.Collection = function (models, options) {
options || (options = {});
if (options.comparator) {
this.comparator = options.comparator;
delete options.comparator;
}
this._boundOnModelEvent = _.bind(this._onModelEvent, this);
this._reset();
if (models) this.refresh(models, { silent: true });
// events simply proxy through.
_onModelEvent : function(ev, model) {
if (ev === 'change:id') {
delete this._byId[model.previous('id')];
this._byId[model.id] = model;
}
this.trigger.apply(this, arguments);
}
});
(function (models) {
models.Contract = Backbone.Model.extend({
Value: "",
Text: ""
});
}(widgets.models = widgets.models || {}));
// Modeling
{
"Operator": "",
"ColumnName": "",
"Value": "",
"RelationshipToPreviousSibling": "",
"Attributes": {
"ModelId": "3e267d46-343b-4f76-9774-3537d425f3e5"
},
search.View = Backbone.View.extend({
events: {
"keydown input": "search"
},
search: function(event) {
var o = {};
_.extend(o,Backbone.Events);
o.trigger('route:search');
search.View = Backbone.View.extend({
events: {
"keydown input": "search"
},
search: function(event) {
this.trigger('search',"myq");
}
});