record.js revision 75659cb0e2deef88afd156725ab2726ee4f963a7
function Record(config) {
Record.superclass.constructor.apply(this, arguments);
}
/**
* Class name.
*
* @property NAME
* @type String
* @static
* @final
* @value "record"
*/
Record.NAME = "record";
/////////////////////////////////////////////////////////////////////////////
//
// Record Attributes
//
/////////////////////////////////////////////////////////////////////////////
Record.ATTRS = {
id: {
valueFn: "_setId",
writeOnce: true
},
data : {
}
};
/* Record extends Base */
Y.extend(Record, Y.Base, {
_setId: function() {
return Y.guid();
},
initializer: function() {
},
destructor: function() {
},
getValue: function(field) {
if (!field) {
return this.get("data");
}
else {
//This should remain [field] instead of .field, because [field] can handle strings
return this.get("data")[field];
}
return null;
}
});
Y.Record = Record;