javascript - How to add a a dynamic row to table on click of a button, and make the existing rows editable on click using Ember -


I want to edit table rows, so for the click, I want to create the column as a text box so that I can edit, and save.

Also, how to dynamically add rows on the click of the add button I know how to use jQuery, but there is no idea in Amber.

Thank you!

I want to emulate such behavior in Amber.

This JSBN has a table, and has a button. Clicking on a button adds a dynamic row as a text-box in the table so that the user can enter the data, which can be saved by pressing another button.

I think your table is bound to an ArrayController model.

  & lt; Table & gt; ... {{Element in Model #}} & lt; Tr & gt; & Lt; TD & gt; {{Element.name}} & lt; / TD & gt; ... & lt; / Tr & gt; {{/ Every}} ...  

Add an action to your controller

  inside the controller functions: {addElement: function () { Var element = this.get ('model'), // model contains data / list for rows NewElement = / * Here your object creation code * /; Elements.pushObject (newElement); }}  

Then in your handler template

  & lt; Button {{action "addElement"}} & gt; Add line & lt; / Button & gt;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -