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 Report] DataTable click:row.ctrl Modifier Not Working #9720

Closed
jim-brown-fst opened this issue Nov 18, 2019 · 7 comments
Closed

[Bug Report] DataTable click:row.ctrl Modifier Not Working #9720

jim-brown-fst opened this issue Nov 18, 2019 · 7 comments
Labels
C: VDataTable VDatatable semver: major Contains breaking API changes T: feature A new feature

Comments

@jim-brown-fst
Copy link

Environment

Vuetify Version: 2.1.10
Vue Version: 2.6.10
Browsers: Chrome 78.0.3904.97
OS: Windows 10

Steps to reproduce

<v-data-table ....... @click:row.ctrl="rowCtrlClicked"> ........ </v-data-table>

Expected Behavior

Event handler fires

Actual Behavior

Event handler does not fire

Reproduction Link

https://codepen.io/jim55063/pen/PooXgWY?&editable=true&editors=101#anon-signup

Other comments

I am replacing an existing data table in our application which allows the user to ctrl+click a row in the table and open that item in a new window (tab).

@click:row.once works, since it doesn't require the event object to be passed to the .once event modifier. But for the .ctrl modifier, since you aren't passing the event to the modifier, it can't check to see if the control key is pressed and filters the event out and the handler isn't called.

Also, since the event isn't passed to the handler, there is no way to know if the user had the ctrl key held down when the row was clicked.

@ghost ghost added the S: triage label Nov 18, 2019
@jim-brown-fst
Copy link
Author

jim-brown-fst commented Nov 18, 2019

Other modifiers like .prevent and .stop and probably most others don't work either due to not passing the event object. They throw console errors.

@MajesticPotatoe MajesticPotatoe added C: VDataTable VDatatable T: bug Functionality that does not work as intended/expected and removed S: triage labels Nov 19, 2019
@jacekkarczmarczyk
Copy link
Member

click:row is not a DOM event, so these modifiers won't work by default, changing the issue to feature request

@jacekkarczmarczyk jacekkarczmarczyk added T: feature A new feature and removed T: bug Functionality that does not work as intended/expected labels Dec 2, 2019
@jim-brown-fst
Copy link
Author

jim-brown-fst commented Jan 27, 2020

@jacekkarczmarczyk It starts out as a click event and then the event gets hidden. This happens in a lot of controls and events actually. Can you just add the event as a second parameter in the handlers so we can use them in our code? Passing along the events allows for more use cases (like the one in this issue) and I can't see any downside really.

@nekosaur
Copy link
Member

For the .ctrl modifier to work we'd have to pass the native event as the first argument. That also has the added drawback of just giving the method name in template @click.ctrl="nameOfMethod" not working since that only forwards the first argument to the handler. So one would have to do @click.ctrl="(e, foo) => nameOfMethod(foo)" or @click.ctrl="nameOfMethod(...arguments)".

Passing the native event as a second argument is certainly possible, but that means any modifiers will have to be replicated manually.

@jim-brown-fst
Copy link
Author

jim-brown-fst commented Feb 18, 2020

Good idea. Or, you could wrap the data in a single object containing both the event and the object. So e.event would be the event object, and e.data for the "foo" object.

@KaelWD
Copy link
Member

KaelWD commented Feb 18, 2020

That also has the added drawback of just giving the method name in template @click.ctrl="nameOfMethod" not working since that only forwards the first argument to the handler

Incorrect

EDIT: I was mistaken, modifiers break this: vuejs/vue#10867

you could wrap the data in a single object containing both the event and the object

Wouldn't work, the first argument has to be an event for the modifiers to work.

@nekosaur
Copy link
Member

nekosaur commented Jan 4, 2023

Fixed in a7cc135

@nekosaur nekosaur closed this as completed Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDataTable VDatatable semver: major Contains breaking API changes T: feature A new feature
Projects
None yet
Development

No branches or pull requests

5 participants