Need repeater element to open dynamic page in a new window

Hi,
My repeater image is currently linked to my dynamic page and when clicked, it opens the page in the same window. What I am trying to achieve is when user clicks the image it opens the dynamic page in a new window. How do I go about achieving this?

Hi,
Is there anybody that can assist with this?

Hi Nathan,
You can use onItemReady method of a repeater and inside the function to declare the type of target.
For more information:

Good luck!
Roi

Hi Roi,
Thank you for your response. This is my code but it still isn’t working.

$w(“#repeater2”).onItemReady( () => {
$w(“#image29”).link = “http://easternstyles.com/Item/{Title}/{Title 2}”;
$w(“#image29”).target = “_blank”;
});

Hi again,
According to this code I guess the result is opening new tab with 404 code.
You should use Template literals and itemData ( $w(“#myRepeater”).onItemReady( ($w, itemData , index) ).
Here is a sample:

$w("#image29").link = `http://easternstyles.com/Item/${itemData.someKey}`; // someKey is just for example.
$w("#image29").target = "_blank";

Roi

Hi Roi,
This is what I have so far.

( $w(“#repeater2”).onItemReady( ($w, itemData, index) );
$w(“#image29”).link = http://easternstyles.com/Item/${itemData.someKey}; // someKey is just for example.
$w(“#image29”).target = “_blank”;
});

Is that all the code required? A lot of errors showing up
And what’s going in place of someKey?

Hi Roi,

I still haven’t been able to figure this one out. I’m not sure what i’m doing wrong. Can you explain in more detail?

Not sure if you figured this out yet but I was struggling as well to get this to work.

Basically, you need to refer to the key that you have in the collection (I think this is always ‘title’).

$w("#myRepeaterName").onItemReady( ($w, itemData, index) => { 
	$w("#myImageName").link = `https://myWebsite.com/myDynamicPage/${itemData.title}`; 
	$w("#myImageName").target = "_blank"; 
} ); 

Replace:

  • myRepeaterName with the name of your repeater element
  • myImageName with the name of your image that the user clicks on
  • myWebsite with the name of your website
  • myDynamicPage with the name of your dynamic page

Hope this helps.

I’m too…
but it’s doesn’t work…)))