Models.Value = Models.Base.extend({ classType: "MODELS.VALUE", defaults: { value: "", //String initialValue: "" //String }, restore: function() { this.set("value", this.get("initialValue")); }, addValue: function(oModelValue) { this.set("value", oModelValue.get("value")); if (oModelValue.get("label")) { this.set("label", oModelValue.get("label")); } }, clear: function() { this.set("value", ""); this.set("label", ""); }, getJSONObject : function () { var unSplittedValue = ""; var unSplittedValueArray = this.get("value").split(":|:"); if (unSplittedValueArray.length > 0) { for (var i=0;i 0) unSplittedValue = unSplittedValue + "\n"; unSplittedValue = unSplittedValue + unSplittedValueArray[i]; } } else { unSplittedValue = this.get("value"); } var theLabel = this.get("label"); if (!theLabel) { theLabel = unSplittedValue; } else { if (theLabel == "") { theLabel = unSplittedValue; } } var toReturn = { unSplittedValue: unSplittedValue, value: this.get("value"), label: theLabel } if (this.get("initialValue")) { toReturn.initialValue = this.get("initialValue"); } var additionalPropertiesFromModel = this.getAdditionalJSONObject(); if (additionalPropertiesFromModel) { for (var attrname in additionalPropertiesFromModel) { toReturn[attrname] = additionalPropertiesFromModel[attrname]; } } return toReturn; } }); Models.ValueCollection = Models.BaseCollection.extend({ classType: "MODELS.VALUECOLLECTION", model: Models.Value });