Answer the question
In order to leave comments, you need to log in
How in the backbone to know that the fetch of the model was successful (event)?
There is a note model and a to_paste collection.
It is necessary to make sure that after filling the note model, the filling of the to_paste collection begins, because in to_paste I want to pass some parameters from note.
How to define an event when fetch is successful?
Filling them one by one (note.fetch(); to_paste.fetch();) and using fields doesn't work due to asynchronous loading.
Below is the code, as I did (several attachments to success), but it doesn't work.
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);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question