Skip to content

fix(Table): handle reactive columns #4412

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

Merged
merged 2 commits into from
Jun 30, 2025
Merged

Conversation

or2e
Copy link
Contributor

@or2e or2e commented Jun 27, 2025

πŸ”— Linked issue

Resolves #4024

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)

πŸ“š Description

Added support for dynamic columns definition, according to the official vue tanstack table example.
Not to be confused with columnVisibility.

πŸ“ Checklist

  • I have linked an issue or discussion.

@or2e or2e requested a review from benjamincanac as a code owner June 27, 2025 21:38
@or2e or2e changed the title feat(Table): reactive column feat(Table): reactive columns Jun 27, 2025
Copy link

pkg-pr-new bot commented Jun 27, 2025

npm i https://pkg.pr.new/@nuxt/ui@4412

commit: 510d1a4

@benjamincanac
Copy link
Member

benjamincanac commented Jun 30, 2025

It did try this multiple times without success, do you have a working reproduction against this fix? πŸ€”

In the linked example, the columns shuffle is done like this which already works without your fix:

const randomizeColumns = () => {
  table.setColumnOrder(
    faker.helpers.shuffle(table.getAllLeafColumns().map(d => d.id))
  )
}

@or2e
Copy link
Contributor Author

or2e commented Jun 30, 2025

Hi!
I have attached the solution's functionality in a unit test, and I also attach 2 sandboxes:
before / after

Yes, I agree that the example from the tanstack documentation that I gave is not quite on topic

Have a nice day!

@benjamincanac benjamincanac changed the title feat(Table): reactive columns fix(Table): reactive columns Jun 30, 2025
@benjamincanac benjamincanac changed the title fix(Table): reactive columns fix(Table): handle reactive columns Jun 30, 2025
Copy link
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for both use-cases, this does seem to do the trick.

(My test was to reassign a ref which didn't work)

@benjamincanac benjamincanac merged commit 4ce6540 into nuxt:v3 Jun 30, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic table columns
2 participants