javascript - How to remove an object using handlebars and backbone -


The problem is having the experimental project.

Then I have a table with a list of 'resources' in my handler template:

  & lt; Tbody id = "resourceList" & gt; {{#each model}} & lt; Tr id = "info_ {{this.attributes.id}}" style = "border-header: solid 1px black;" & Gt; & Lt; Td width = "3%" & gt; & Gt; Button style = "background: none; limit: none;" & Gt; & Lt; I id = "icon" square = "glyphicon glyphicon-plus-sign" & gt; & Lt; / I & gt; & Lt; / Button & gt; & Lt; / TD & gt; & Lt; Td id = "title" width = "67%" & gt; {{This.attributes.title}} & lt; / Td> & Lt; Td width = "10%" & gt; {{This.attributes.Type}} & lt; / Td> & Lt; Td width = "10%" & gt; {{This.attributes.itemsNeeded}} & lt; / Td> & Lt; Td width = "10%" & gt; 04/05/2014 & lt; / Td> & Lt; / TR & gt; & Lt; Tr id = "extension_ {{this.attributes.id}}" style = "border border: solid 1px black;" & Gt; & Lt; Td colspan = "5" & gt; & Lt; Div id = "extension" class = "zambotron" style = "margin-left: 1%; margin-right: 1%;" & Gt; & Lt; Div & gt; {{This.attributes.orgName}} & lt; / Div & gt; & Lt; Div & gt; {{This.attributes.email}} & lt; / Div & gt; & Lt; Div & gt; {{This.attributes.phoneNumber}} & lt; / Div & gt; & Lt; Div & gt; {{This.attributes.address}} & lt; / Div & gt; & Lt; Br> & Lt; Div & gt; {{This.attributes.description}} & lt; / Div & gt; & Lt; Div style = "margin-top: 5%; margin-right: 5px;" & Gt; & Lt; Input type = "button" class = "btn btn-danger" style = "margin-left: 5px;" Id = "delete_post" value = "delete" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt; / TR & gt; {{/ Every}} & lt; / Tbody & gt;  

This delete button triggers an event in the button view

  Events: {"#submit_post click": "Create", "# Delete_post ":" remove "},  

is the function of deletion where I am lost I do not know how I can know which line was selected and Passed it to see. I tried to make the button class = "{{this.attributes.id}} so that each one will be selected as a class 1,2,3,4 ... but I can not understand how I get the class I am sure that this is actually something basic, again, sorry: /

 remove : function () {this.model.destroy ();}  


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 -