vuetable-2 icon indicating copy to clipboard operation
vuetable-2 copied to clipboard

[vuetable v2.0] Re-render field component on page change

Open bartversluijs opened this issue 4 years ago • 1 comments

Hi,

I need the new VuetableFieldMixin, so I'm using the next package. I've created some Field Components, and it does exactly what I want. However, there seems to be a bug in those components.

When I change pages, the component doesn't re-render. So row 1 of page 1 has the same data in the Field Components as row 1 of page 2. The mounted doesn't get triggered when going to page 2. (Weird side note, the mounted does get triggered when returning to page 1).

I was trying to add a key to the component, but that doesn't seem possible (based on the ID of the rowData).

Is there any way to listen to changes or just re-render the components on page change? This causes huge problems in our project at the moment.

Thanks in advance!

bartversluijs avatar Aug 17 '20 11:08 bartversluijs

After typing this issue, I thought about the watch function of Vue. So I used this:

watch: {
  rowData (row) {
    // Function to update the data
  }
}

This seems to work, however, it would be prettier if this worked out of the box instead having to create a watch function for every component.

bartversluijs avatar Aug 17 '20 11:08 bartversluijs