Dynamic looping of JSON object does not work
Hi,
I'm showing a nested JSON object in a table using ng-repeat. As seen below:
<table>
<thead>
<tr>
<th ng-repeat="(key,data) in dbCtrl.data[0]">{{key}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in dbCtrl.data">
<td ng-repeat="data in row" editable-text="data">{{data}}</td>
</tr>
</tbody>
</table>
This prints out the table and it is also editable. But the edit only affects the visual representation of the JSON object, the "underlying" one is not changed. If i however change the code the below everything works as expected:
<tbody>
<tr ng-repeat="row in dbCtrl.data">
<td editable-text="row.PSYPRI_CURRENCY">{{row.PSYPRI_CURRENCY}}</td>
<td editable-text="row.PSYPRI_ID">{{row.PSYPRI_ID}}</td>
<td editable-text="row.PSYPRI_MAX">{{row.PSYPRI_MAX}}</td>
<td editable-text="row.PSYPRI_MIN">{{row.PSYPRI_MIN}}</td>
<td editable-text="row.PSYPRI_ROUND">{{row.PSYPRI_ROUND}}</td>
<td editable-text="row.PSYPRI_TYPE">{{row.PSYPRI_TYPE}}</td>
</tr>
</tbody>
What is wrong in the dynamic way that causes the "underlying" JSON object to not be changed when performing an edit and saving?
Is this still an issue? If so, can you provide a jsfiddle or plunker?
@alzorz is this still an issue?
@ckosloski not sure if this is still actively maintained, but here's a jsfiddle demonstrating it not working. https://jsfiddle.net/mochsner/8vw0ae13/36/
Interestingly, I can get this working with the identical code in certain contexts, such as when I change the existing table (using json object) from the Angular-xeditable example pages. Here's that example of identical code, but working: http://jsfiddle.net/mochsner/6bat1nLy/48/
Note: above issue may be realted to issues with fsfiddle.net itself. Found it quite odd though, so wanted to note it just in case before closing