Still cant find option to link repeater to dynamic page


Im really disappointed, lost almost whole day just to solve this puzzle. Any help will be appreciated. So the problem is to link repeater to dynamic pages, but content works wine , every dataset field is connected to specific item, and site viewers can see the content, but thats it, the I couldn`t find option to link it to dynamic page. Dynamic pages works wine.

Hi Raivis,
Some code is needed in order to do it.
Here is a sample:

import wixLocation from 'wix-location';
$w.onReady(() => {
	$w("#myRepeater").onItemReady(($w, dataItem, index) => {
		let linkToDynamicPage = dataItem["link-to-your-dynamicpage"];
		$w('#yourElement').onClick(() => {
			wixLocation.to(linkToDynamicPage);
		});
	});
});

For more Information:

Good luck!
Roi

2 Likes

what exactly looks link to dynamic page, if dataset goes by name concerts, but selection goes by title www…/concerts/title?

Hi Raivis, if I understand you correctly, you should be able to do this without code.
If your repeater is connected to a collection of items, you can have each slide in the repeater link to the relevant item page. Select a linkable element in one of the slides, like an image or a button, and connect it to the dynamic page.
For example, I have a vacations collection and a vacations item page. In the following screenshot I connect a button inside the repeater to the vacations item page (the repeater is already connected to the vacations dataset):

Please let us know if you manage to get it working, or you need further help. Good luck!

1 Like

I know, that I was hopping to find, but this is some kind of bug, because I had repeater with image in the container, but I could not to link it. But I found workaround, placed a new image on top of the repeater, connected to dataset, linked it, arranged it in the back, deleted image from repeater.

Hi Rio,

Am trying to link a button in my repeater to a dynamic page using your code, but am getting error and it’s not working.

Following is the code:

$w.onReady(function () {
$w(‘#resultsRepeater’).onItemReady(($w, itemData, index) => {
$w(“#titleElement”).text = itemData.title;
$w(“#courtElement”).text = itemData.court;
$w(“#dateElement”).text = itemData.date;
$w(“#citationElement”).text = itemData.citation;
$w(“#heldElement”).text = itemData.held;
$w(“#IDElement”).text = itemData._id;
$w(“#documentElement”).link = itemData.document;

// Currently added code from here

let linkToDisplayPage = dataItem[“link-references-_id-referrence-title”];

$w(“#displayElement”).onClick(() = {

wixLocation.to(linkToDisplayPage)

});

// Till here

	const hasDoc = itemData.document; 
	if (hasDoc) { 
		$w("#documentElement").label = 'Download Judgment'; 
		$w("#documentElement").enable(); 
		$w("#displayElement").enable(); 
		} else { 
		$w("#documentElement").label = 'Judgment & details to be updated soon'; 
		$w("#documentElement").disable(); 
		$w("#displayElement").disable(); 
	} 
}); 

Please guide what am doing wrong.

Thanking in anticipation.

Anupam Dubey

Hello Roi,

In the code sample you gave, how can we insert the “linkToDynamicPage” with a wix-data query result for the author ID (connected to a Repeater) which will then direct user to the corresponding profile of the author of the data entry? Exactly the way our username appears on this Wix Forum post, where I can hover on any Username/Author of Data Entry, and be directed to that user’s/author’s profile page.

I appreciate any insight any Wix Code gurus can give.
Thanks.

-Nelson

1 Like

@tomer-wix Has something happened…my dynamic page links started going awry today. Linking to wrong dynamic pages, etc. I went back and totally redid everything and can not get to work. My link for ID page works so individuals see their own page, but the link from repeaters will not take person to dynamic page for item in the repeater

Hi, i have the same problem here.
i can’t connect my repeater to dynamic page. i’ve tried:

import wixLocation from ‘pekerjakuliner/{item}’;
$w.onReady(() => {
$w(“#repeater1”).onItemReady(($w, dataItem, index) => {
let linkToDynamicPage = dataItem[“pekerjakuliner/{item}”];
$w(‘#container3’).onClick(() => {
wixLocation.to(linkToDynamicPage);
});
});
});

my repeater page url is https://www.rangkul.org/kuliner
and my dynamic page url is https://www.rangkul.org/pekerjakuliner/{item}

i’m realy new in this coding wordl. please help me!

Thank you

2 Likes

@jeff-haskins me pasa lo mismo no he podido configurar una nueva seccion que me lleve a la pagina dinamica.