0

I have a button in a vaadin grid that I want to open a link in a new tab, but it doesn't work inside the grid. I tested the code outside the grid, and it worked there. Everything is done using Lit.

Here's part of the code:

<vaadin-grid-column resizable="" path="action" header="Action">
  <template>
    <button @click="${this._openTab()}"Test</button>
  </template>
</vaadin-grid-column>

The _openTab function:

_openTab(e){
  window.open("https://google.com", "_blank");
}
  • The link in _openTab() will be replaced with a variable. – What_Is_CoMpUtErScIeNcE Jun 29 '22 at 19:09
  • I also tried using location.href, but this also didn't work in the vaadin-grid. – What_Is_CoMpUtErScIeNcE Jun 29 '22 at 19:09
  • Unsure without a reproducible example, but there are some bugs in the code sample. For example you've not closed the `button` opening tag. And you're also calling the `_openTab` method and binding its return value (undefined) instead of binding the method itself. Fix: ` – YouCodeThings Jul 28 '22 at 20:36

0 Answers0