awa.mvc.ModelAttributeTypes.collection Class
Defined in:
Module: awa.mvc.ModelAttributeTypes
/var/www/azaleahealth.com/branches/docs/source_repo/awa/resources/apps/js/awa/mvc/ModelAttributeTypes.js:181
Collection of items. Usually intended for 1 => many relationships ie. patient => patient problems
pat_problem_history: {
_info: "added from medical/PatientsProblemModel incase build does not have patient problems.",
name: "Problem History",
type: "collection",
//resource can be provided to generate a subresource url
//if the following were active, the url would be patients/[pat_id]/problems
//Be careful with this, as the url may not pass on to the individual models
//of that collection
//resource and collectionArgs.url should NOT be used at the same time
//resource: 'problems',
//collectionArgs can be a raw object or function that returns an object
//these args are passed straight a {awa.mvc.Collection} constructor.
//That collection is then set as the property.
//If a function is provided, it is scoped to the model
collectionArgs: function(){
var out = {};
out.model = 'medical/PatientsProblemModel';
if(!this.isNew()){
out.url = _.result(this, 'url')+"/problems";
}
out.order_by = "pip_diagnosed_ts";
out.sort_by = "DESC";
out.filters = {pip_disabled: 0};
return out;
}
}