How to 'watch' newly created rows in local storage in VueJs?

Viewed 1340

I am working to create a grid like component in VueJs. You can see the JSFiddle here: https://jsfiddle.net/masade/nrb9f4j2/

  • In the above fiddle the <datacell> component is used to allow inline edit for any cell.
  • I am 'watch'-ing changes to the rows and saving them in local storage
  • A newly created row is being pushed to parent object by this.$parent.unshift(newrow) in the <addrow> component

The problem is when I add a new row, though it is being added to the rows local storage it is not being watched for changes

Steps to replicate the issue (on JS fiddle):

  • Click on Add Row and enter a name to add
  • Once the row is added, click on the second column (year) and update it
  • Any changes to newly added row is not being updated
  • However if you refresh the page, and modify the same again, I am able to update it again.

Please help me understand if I am doing something wrong

2 Answers
Related