I'm completely stumped on how to make this work. I can successfully create the models, but running create or anything else on them afterwards seems impossible. It's been 6 long hours of trying and failing... Can someone please point out where I'm messing up? :(
1) Begin by creating a WorkflowCollection
this.workflows = new WorkflowCollection();
and set workflows.length = 0
.
2) Now, add empty workflows for each workflow id (var workflow = [1,2,3]
):
for(var i =0;i<workflow.length;i++;) {
this.workflows.add(new Workflow({fk_workflow_id: workflow[i]}));
}
3) Update workflows.length = 3
. Next, render the views for the current workflows:
var self = this;
this.workflows.each(function(model) {
self.renderView(model.get("fk_workflow_id"), model);
});
The renderView function, for instance, triggers:
if(this.kit) this.kit.close();
this.kit = new Workflow.PostageView({
model: model
// posView may change el? check later
});
4) Attempting to fetch new data for updating the view's models. BUT IT'S NOT WORKING.
this.workflows.fetch({
success: function () {
self.workflows.each(function (model) {
self.renderView(model.get("fk_workflow_id"), model);
});
}
});
5. Trying to save a model:
FileApp.workflowRouter.pos.create is not a function
What could be preventing access to create?! Check out the complete code: http://jsfiddle.net/8upZK/