Search code examples
vuejs2rerenderv-data-table

How to rerender v-data-table on VueJS 2


I have a v-data-table. On a pop up, I select a few of the columns of the table and combine these values and add them back to the table as a new column. My problem is, I can't re-render the v-data-table after I clicked my Save button. I tried $forceUpdate but didn't work. What can i use?


Solution

  • It's pretty weird it doesn't get rerendered automatically. But one solution could be to assign your data an empty array (I assume it's an array) and right after it put:

    tabledata = []; // empty your data here
    Vue.nextTick(function () {
       tabledata = [0,1,2]; // assign your new data here
    })
    

    https://v2.vuejs.org/v2/api/#Vue-nextTick