backbone.js - How do I leverage Marionette to rerender a nested CompositeView after a child's model is destroyed? -


I thought that Marianaut will automatically remove the ideas of deleted models but it is not working in my situation . I have a holistic view that displays the collection of movies. Each film has a list of actors. When I click on "delete movie", then it should remove all the associated actors and update the scene of that special movie that was deleted. Currently, my application destroys the model but the view has not been updated. If I refresh the page, then the movie and related actors have gone, so I know that it is destroying the model, just the thoughts of that moment have been clicked not only.

Relevant control code: list_controller.js * / MovieApp.module ("ActorsApp.List", function (list, movie app, backbone, meriannet, $, _) {list. Controller = {listActors: function () {var actor = movie app. Request ("actor: entities"); var movies = new backbone selection; var allMovies = MovieApp.request ("movie: entities"); actor Function (Actor) {movieId = actor.get ("movieId"); if (! Movies.get (movieId)) {//console.log(_Movie not found. Adding to list list.); Film = All movies. ( Film id); selected actors = Actor where ({Movie: MovieID}); //console.log ("Selected Actor:", Selected Actors); Film Actor = Selected Actors; Movies.Ed (All Movies (MovieID));} and {console.log ( "Movie View: Actor: New", Function (Child Scene, Models) "Movie View: Actor: New", "The Movie is found in the list.")}}}; Var movieslistview = new list.movies ({archive: films}); ) {MovieApp.ActorsApp.New.Controller.newActor (model);}); Movieslistview .on ("Itemview: ItemView: Actor: Show", F. Kshn (Balwu model) {MovieApp.ActorsApp.Show.Controller.showActor (model); }); MoviesListView.on ("Item View: Film: Show", Function (Child Scene, Model) {MovieApp.MoviesApp.Show.Controller.showMovie (model);}); (child.model.destroy);}); // It removes a model from movies. LISTView.on ("Item View: Movie: Delete", Function (Child Scene, Model) {childView.children.each (Function (Toddler) Collection This.collection.remove (childView) .model); this.render ();}); moviesListView.on ("Item View: ItemView: Actor: Delete", Function (Child Scene, Model) {model.model.destroy ();}); MoviesListView.on ("Movie: list", function () {MovieApp.MoviesApp.List.Controller.listMovies ();}); MovieApp.mainRegion.show (moviesListView);}}});

Here is my view code:

  list.movie = marriott Composite view. Extension ({tag name: "li", template: "# actor- movie-list-item", see item: list. Author, start: function () {console.log ("actor:", this.model.actors) ; Actors = this.model.actors; this.collection = artist; this .collection = new backbone.collection (actor);}, Event: {"click on a.js-remove-movie": "Deleted Deleted "}, Delete deleted: function (e) {e.preventDefault (); e.stopPropagation (); this.trigger (" movie: delete ", this.model);}, appendHtml: function (see archive, item view , Index) {var container; container = this. $ ('Recipe-list'); Container.exe (itemView.el);}, renderer: function () (if (_. Uidffield (this cipher)) {it. $ ("Ul: first"). Remove ();} console.log (" );}});    

I do not completely see what you can achieve , But if you want to update ideas after destroying a model:

  Recipes LISTView.on ("Item View: Movie: Delete", function (childView) ) {// This removes a model from recipes Planet .collection.remove (childView.model);});   

It believes that your recipes are either a collection of ListView - or a holistic view also:

I use an overall view and through events A bella has also been created to remove an item:

If the above does not help you, you can explain:
- In list.view, < What is code> this.model.actors ?
- How your ideas are structured (see nesting type) - How is your data defined in models and collections?

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -