Repository navigation
QTable: let rows be real links so they can be opened in a new tab #18588
Unanswered
NureddinSoltan
asked this question in
Ideas / Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone 👋
I use QTable a lot for list pages, and one thing keeps bothering me: there's no way to make a row an actual link.
Right now the only option is
@row-clickand then callingrouter.push()myself. That works for a normal click, but because there's no real<a>anywhere, all the usual link behavior is lost:My users constantly want to open several rows in separate tabs to compare them, and I kept having to explain why they can't. So I went ahead and implemented it in QTable itself. Honestly, I love how it turned out, and I really believe it would be a good addition.
What I'm doing today
Until then, to get real links I have to take over the whole
bodyslot and put arouter-linkin every cell, then use CSS so the link fills the cell (QTable cells are 48px tall with7px 16pxpadding, so otherwise only the text is clickable):It works, but:
denseor custom paddingWith the props below, all of that becomes one line:
What I'm proposing
Three small opt-in props, following how QBtn/QItem handle
to/href:row-to: (row) => RouteLocationRawmakes each row a Vue Router linkrow-href: (row) => stringmakes each row a plain URL link (wins overrow-to, likehrefoverto)row-target: stringsets the link target, e.g._blankHow it would behave:
<a href>, so the context menu, keyboard (one Tab stop, Enter opens it) and screen readers work natively@row-clickstill fires first, andevt.preventDefault()in it cancels the navigationbody/itemslots aren't touchedIt's fully opt-in, so nothing changes for existing tables.
Ready to open a PR
The implementation is done, with tests (props, router/new-tab behavior, interactive content, grid mode, accessibility) and a docs section with an example. If this sounds like something you'd accept, I'll open the PR against
devand link it here.I'd really love to see this in Quasar. It's something I need in pretty much every project.
Open to any feedback on naming or behavior!
All reactions