Page 1 of 1

[REACT] unexpected behaviour of anchor in columns renderer

Posted: Thu Mar 23, 2023 6:08 pm
by matb

Instead of using the cellClick event and/or the column context menu, we would like to use native anchor elements in the columns renderer.

Desired behaviour:
CTRL + click or target="_blank" will open the destination in a new tab

Observed behaviour:
Neither will open the destination in a new tab, but the current tab.

Our configuration:

  const columns = {
    data: [{
        type: 'tree',
        text: '',
        field: 'name',
        htmlEncode: false,
        renderer({ record }) {
          return `
          <div>
            <a href="some-destination" target="_blank">click me</a>
            <a href="some-other-destination" target="_blank">click me, too</a>
          </div>
          `;
        },
      },
    ],

Is there anything we can do, to make it work?


Re: [REACT] unexpected behaviour of anchor in columns renderer

Posted: Thu Mar 23, 2023 7:36 pm
by marcio

Hey,

I added your code to our React demo and it worked correctly when clicking the link, it opened in a new tab (as you'll see in the video).

Which version are you using?


Re: [REACT] unexpected behaviour of anchor in columns renderer

Posted: Thu Apr 06, 2023 10:48 am
by matb

Thanks for your quick response. We are using 5.3.1 and since we switched to a combined solution with rendered anchors together with a cellClick listener we don't have any issue anymore.


Re: [REACT] unexpected behaviour of anchor in columns renderer

Posted: Thu Apr 06, 2023 4:17 pm
by alex.l

Thank you for the update!