Closed dragermrb closed 7 months ago
There already has a link type for column.
columns: MtxGridColumn[] = [
{
header: 'anchor',
field: 'anchor',
type: 'link',
},
]
Or you can also use custom template. https://ng-matero.github.io/extensions/components/grid/overview#custom-cell-template-2
Hi @nzbin
I was thinking of having several buttons/links in the same cell. For example two links (view, edit) and one delete button (with confirmation).
I'm currently using custom templates, but I think it might be useful to have link type buttons.
As your demand, you can use the API window.open
instead of a
link.
If I use window.open
the links always opens in a new window.
With a normal a
link, the user can navigate in the same window or open the destination in a new one (context menu->open in new tab or with the middle mouse button).
I'm currently using custom templates, witch solves the problem, but I think the PR I propose can be useful.
If I use window.open the links always opens in a new window.
open()
open(url)
open(url, target)
open(url, target, windowFeatures)
https://developer.mozilla.org/en-US/docs/Web/API/Window/open#parameters
As your image shows, I think the view
and edit
button should navigate a new route, it's better to use Angular Router (this.router.navigate()
) instead of open()
.
With lots of projects I do, I hadn't use a
link yet. If you really need a link, please use the custom template.
Thanks @nzbin
Hi!
Regarding the
data-grid
component, I would like to be able to have links as column buttons instead of buttons, that is, a button type'link'
that generates an anchor tag (<a ...>
) instead of a button tag (<button ...>
)The reason is to be able to open the links in a new tab if the user needs it (for example by clicking on a link with the central mouse button). This behavior is not possible with
<button>
tags.Would you accept a PR that implemented such functionality?