I have the model 'note' and the collection 'to_paste'. I want to fetch 'to_paste' after my model 'note' was fetched successfully because in 'to_paste' I want to use some parameters from 'note'.
So, what's the event I should use?
I did the next things but I'm sure it's wrong (I just fetch collection in model success).
note.fetch({
success: function (collection, note1) {
var noteView = new Memo.Views.FullNote( {model: note}, {flag: 1 } );
var to_paste = new Memo.Collections.NotebookList();
to_paste.fetch({
success: function (collection) {
var notebooks_to_paste = new Memo.Views.NotebookListToDelete( {collection: to_paste} );
var notebook_id = note.get("notebook_id");
$('.example').html(notebooks_to_paste.render().el);
}
});
$('.content').html(noteView.render().el);
}
});
Aucun commentaire:
Enregistrer un commentaire