How to make code generated dynamic link in a repeater to open in new window?

Hi all,

How to make code generated dynamic link in a repeater to open in new window or a popup once clicked, so that user can have more than one dynamic link open at the same time?

$w(“#resultsTable”).columns = [
{
id: “col1”,
dataPath: “title”,
label: “Party Name”,
width: 150,
visible: true,
type: “string”,
linkPath: “link-JudgmentNotes-_id-title”
//linkPath is set to the dynamic url field in the dataset.

How to code this so that the link opens in a new window instead of the current window?

Alternatively, how can this link value be set to something similar to:

https://www.daaman.org/Jud.../{link-JudgmentNotes-_id-title}
OR
linkPath: “https://www.daaman.org/JudgmentNotes/{ID}/{Referrence}

How to set both the link and target attributes to enable it open in new window?

Please help

Thanking in anticipation
Anupam Dubey

Hello

i suggest two ways:

first you can use .link method to make it open based on the target you set (_blank) - here

second idea, you can and html component and on click you send the link msg to it and makes it open in a new window using html component code:

<script type="text/javascript">
 window.onmessage = (event) => {
   if (event.data) {
     window.open(event.data);
   }
 }
</script>

check the html component message event -here

Best
Massa

Thanks for the response Massa,

Am trying with the code below, but it isn’t working.

$w.onReady(function () {
$w(‘#resultsRepeater’).onItemReady(($w, itemData, index) => {
let linkToDisplayPage = https://www.daaman.org/references/$itemData{"link-references-_id-referrence-title"};

$w(“#displayElement”).target = “_blank”;


Where ‘https://www.daaman.org/references/ is the dynamic page that has to be opened in new window in accordance with dynamic link 'link-references-_id-referrence-title ’ from the database.

There is some error in this, please guide what am doing wrong.

Thanking in anticipation.

Anupam Dubey