user1464139
user1464139

Reputation:

What's the most easy way to add a new row to an ng-grid table with AngularJS?

I have an ng-grid table that's populated with data. I looked through the documentation and searched on Google but I can find no examples of how to add a new row to the grid.

Is there any special way that people use to add new data. I am just hoping to find some examples that I can work from. So far I found nothing. I wish that the ng-grid site could have just one example. I'm sure I am not the only person who has needed to add a row to an ng-grid.

Thanks

Upvotes: 5

Views: 12624

Answers (1)

Tosh
Tosh

Reputation: 36030

Here is the example: http://plnkr.co/edit/1uLcok?p=preview

(fixed a broken link to the library): http://plnkr.co/edit/GdstXN?p=preview

You can simply modify the array. It is angularJs' responsible for updating the view. (If the data modification happens outside of angularjs, then you need to call $apply against the scope.)

Upvotes: 6

Related Questions