Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Vue-Tabulator don't remove old column, if I install new options. #44

Closed
aalopatin opened this issue Nov 14, 2019 · 6 comments · Fixed by #58
Closed

[BUG] - Vue-Tabulator don't remove old column, if I install new options. #44

aalopatin opened this issue Nov 14, 2019 · 6 comments · Fixed by #58
Labels
bug Something isn't working waiting admin Waiting a admin interaction

Comments

@aalopatin
Copy link

Hi!

I try to change a set of columns in the options of the tabulator.
When I add new columns it works, but when I remove column from options, they aren't removed.

Here is part of my code.

I have a method - setPeriods(), which set columns in the options object.

setPeriods() {
    let length = this.optionsDataReports.columns.length
    let columnsPeriods = this.selectedPeriods.map((period) => {
      return COLUMNS_ENTER_REPORTS.columnPeriod(period.id, period.id)
    })
    this.optionsDataReports.columns.splice(1, length-1, ...columnsPeriods)
},

If new Periods are added in selectedPeriods it work correct:
AddColumns

But if I delete columns, tabulator instance isn't updated:
DeleteColumns

But the options object is updated in Vue:
OptionsAfterDeleteColumns

I can't solve this problem. Can you help me?

@aalopatin aalopatin added bug Something isn't working waiting admin Waiting a admin interaction labels Nov 14, 2019
@aalopatin
Copy link
Author

I don't know if it's Vue-tabulator or Tabulator problem.

@angeliski
Copy link
Owner

Hey @aalopatin
Can you try reproduce that behavior in fork fiddle? https://jsfiddle.net/angeliski/z8wbvr10/

@aalopatin
Copy link
Author

aalopatin commented Nov 15, 2019

Hey @angeliski
I've added buttons Add and Remove

Add - adds 2 columns to replace everything after the second column
Remove - adds 1 column to replace everything after the second column

If click Remove and then Add it works
But if click Add and then Remove it doesn't work

https://jsfiddle.net/utqr2ywh/3/

@angeliski
Copy link
Owner

Thanks @aalopatin

I will try find the bug

@BryceBarbara
Copy link

BryceBarbara commented Jun 29, 2020

@angeliski It looks a bug contributing to this is in this line: https://github.com/angeliski/vue-tabulator/blob/dev/src/components/TabulatorComponent.vue#L58

instead of

...mergeWith(this.eventOptions, this.options, merge),

try doing

...mergeWith({}, this.eventOptions, this.options, merge),

@angeliski
Copy link
Owner

Hey @BryceBarbara Thanks for the advice
I will try to get that

angeliski added a commit that referenced this issue Aug 7, 2020
The reference in the watcher function is reclyced between updates, now the object is new and
isolated

fix #44
@angeliski angeliski linked a pull request Aug 7, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting admin Waiting a admin interaction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants