oooyaya oooyaya - 1 year ago 248
AngularJS Question

AG-Grid cell template value change

I am tinkering with ag-grid in Angular 1 mode and have come across a strange problem. Using the tutorial, I have recreated the problem in this plunkr which I am having in my more complex code. You can see it by double clicking the "Athlete" column values.

Simply put, if you go in to edit mode on an editable column which has a template applied, the value will blank out. It doesn't matter what you set it as, the binding appears to be broken.

For instance:

template: "<div ng-bind='data.athlete'></div>"

Will return something like:

<div>Michael Phelps</div>

But when you double click it to edit it, it will forever after return something like:

<div ng-bind='data.athlete'></div>

I suspect data.athlete is being unbound by the save, but I'm not sure how to correct that. I'd really prefer not to have to create a value change handler for every column I plan to bind in.

The same happens if you use string interpolation.

Answer Source

Instead of cellTemplate use cellRenderer. It is much more useful and you can do a lot more with it. Here is your adjusted plnkr

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download