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

UTable row click event UI3 #3010

Open
richard-hernandez-dev opened this issue Jan 3, 2025 · 6 comments
Open

UTable row click event UI3 #3010

richard-hernandez-dev opened this issue Jan 3, 2025 · 6 comments
Labels
bug Something isn't working triage v3 #1289

Comments

@richard-hernandez-dev
Copy link

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

3.0.0-alpha.10

Reproduction

<UTable
:data="data"
:columns="columnsTable"
@select="select"
/>

Description

In Nuxt UI v3, the component does not provide any trigger event when clicking on a table row. In contrast, the v2 version included the @select event, which allowed developers to handle row clicks effectively. This regression impacts the ability to implement common interaction patterns, such as handling row selection or performing actions based on user clicks.

Does Nuxt UI v3 have an event similar to the @select event from v2 for the component? Specifically, is there a way to trigger an event when a table row is clicked?

Additional context

No response

Logs

@richard-hernandez-dev richard-hernandez-dev added bug Something isn't working triage v3 #1289 labels Jan 3, 2025
@architjee
Copy link

@richard-hernandez-dev . Forgive me if I overstep or presume, but isn't update:rowSelection event helping your use case.

@HugoRCD
Copy link
Contributor

HugoRCD commented Jan 3, 2025

There's no event on the row click for the moment, but you can already implement features to select rows from the table 🤔 What exactly would you need that for?

@richard-hernandez-dev
Copy link
Author

richard-hernandez-dev commented Jan 3, 2025

I want to add an event so that when I press a row, it retrieves the id and uses it in a function. Here's an example implementation:
<UTable
:data="vehicles?.data ?? []"
:columns="columns"
:loading="pending"
sort-asc-icon="i-tabler-arrow-up"
sort-desc-icon="i-tabler-arrow-down"
ref="table"
class="cusror-pointer"
@select=navigateTo(/my-url/${row.id})
/>
like the version V2

Forgive me if I overstep or presume, but isn't update:rowSelection event helping your use case.

I want to add an event that triggers when I press a row, allowing me to retrieve the id of the row and use it in a function. However, I don't want to update the selection itself. Here's an example in V2:
<UTable v-model="selected" :rows="people" @select="select" />

@caiotarifa
Copy link

caiotarifa commented Jan 3, 2025

@architjee @HugoRCD

I believe these are different things. What @richard-hernandez-dev meant is that he'd like a trigger similar to @select that was present in version 2. Previously, this trigger worked as if it were an @click on a table row. This was especially useful when there was a need to navigate the user to another page upon selecting/clicking a table row.

In version 3, we have @row-selection, which is more related to row selection rather than clicking on a row.

@HugoRCD
Copy link
Contributor

HugoRCD commented Jan 3, 2025

Ok, I see this could be simple enough to add. There are plans to add more Tanstack features; however, I haven't seen a feature related to clicking on a row 🤔 I'll see about maybe making a PR!

@caiotarifa
Copy link

caiotarifa commented Jan 3, 2025

Possibly related with #2822.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage v3 #1289
Projects
None yet
Development

No branches or pull requests

4 participants