2

I am creating a grid using the ng-repeat directive. I need to be able to edit inline, which I achieved using the same idea provided here. I now also need to be able to add new rows to this grid on click of a button. I am doing this by pushing a new entry to my collection on each button click, which inserts a new row into my grid. I want this new row to get added in editable mode. However, to do that, I need to be able to set the editMode property to true dynamically while pushing the new row. How can I achieve this?

JSFiddle: http://jsfiddle.net/Thw8n/69/

2 Answers 2

5

You did everything right, except binding to editMode field. Just change

data-ng-show="editMode"

to

data-ng-show="entry.editMode"

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, it works for adding a new row, but now I have a new problem. The Cancel button requires 2 clicks to reset the row, and I can't figure out why. The first click resets the data, the second replaces the textboxes with the labels. jsfiddle.net/Thw8n/86
2

if i understand your problem in right way the following will be answer .

Just replace editMode with enty.editMode in your html handlebars.

I was applied this solution to the your jsfiddle it is working fine for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.