angular-xeditable icon indicating copy to clipboard operation
angular-xeditable copied to clipboard

Dynamic looping of JSON object does not work

Open alzorz opened this issue 10 years ago • 4 comments

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?

alzorz avatar Feb 05 '15 17:02 alzorz

Is this still an issue? If so, can you provide a jsfiddle or plunker?

ckosloski avatar Nov 16 '16 02:11 ckosloski

@alzorz is this still an issue?

ckosloski avatar Aug 25 '17 21:08 ckosloski

@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/

mochsner avatar Dec 14 '20 01:12 mochsner

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

mochsner avatar Dec 14 '20 01:12 mochsner