javascript - backbone.js remove item from series -


I am currently learning backbone.js and thinking about removing an item from a series. I'm working on the infamous recipe app and I'm directing step by step in the terrace. I want to be able to delete a text without removing all of them. The construction event is like this:

  "#btnAddDirection click": "addNewDirection" addNewDirection: function (ev) {Ev.preventDefault (); This.directionCount ++; This.render (this.directionCount); },  

and my clearance looks like this:

  Click '.subDirection': 'Subdivisions' subdivision: function () {this. $ El Deletion (); }  

I have the issue that when I click on the [-] button, all the directions are removed instead of a single. I am thinking that for the direction I have to give some type of identifier. Any help would be appreciated. Thank you.

Here is the full direction control view:

  // See the direction control all directions control = backbone. View. Extension ({rendere: function (directionCount) {if (directionCount == null) {directionCount = 1;} var = this; var directions = new directions (); var full guides = _.in vocals (instructions, 'fetch'); $ .apple ($, full guideline) .done (function () {var template = _.template ($ ('# direction-control-template') .html (), {directions: directions.models, directionCount: Directioncount}); $ ('.blbl direction') .each (function () {$ (this) .find ('adddirection'). Remove (); $ (this) .find ('newdirection'). ');}); $ (He. $ El) .append (template);});}, Event: {"#btnAddDirection click": "addNewDire Ction", click on' .sub direction ':' Subdirectory '}, direction Instructions: 1, AdineDurection: Function (EV) {ev.preventDefault (); this.directionCount ++; this.render (this.directionCount);}, Subdication: function () {this. $ El.remove ();} });  

In this situation, the best practice will be to give each direction its own personal view Later, if you create an event within the direction view, then it will only trigger the elements of that view.

After the instructions are brought to your callback, you can try loop in directions in each and create a new guideline visual view:

Direction = backbone.View Extension ({Event: {/ * Click for individual direction Renderers here: Function ()

After creating this new file, you can render it in main view :

  $ (that $ l.) .append (directionView.render ().);  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -