(Solved) Link Search result in repeater (multiple databases) to corresponding dynamic page.

Yep.

Have you tried it on your LIVE site ?

Yes. I did as well.
No difference.

Ok temporary just change the URL in the code to www.google.com to make sure the wixLocation re-direct code is working.

If it re-directs to google then it means the URL is not formed correctly in the code of your webpage.

Also note you are console logging items after the wixLocation re-direct code. These should be put before as you need to log them before you get re-directed to the next webpage or else they will not get logged when the re-direct is working.

Ok. Changed it too Google.com temporary.
Hope I did it correctly.
But no result.

like this

wixLocation.to(‘https://google.com’);

Hi Mike, thanks again!

Changed position of logging items (thanks)
Changed the re-direct URL to google and it now re-directs to google.
So the URL is not formed correctly.

but I have stumbled upon some errors, not in wix but in dev.console log.
I’ll dive into this first and will come back to you later today…
Maybe this is causing te correct linking

log the URL that is being formed and compare it to the URL that you require for linking to your page and change as necessary

console.log(‘/collectionID/’ + dynamicPageID);

@mikemoynihan99
Thanks. I’ll get this result:

Ok so that’s no good as it is not the URL that you require.

Try console.log(‘/’+collectionID+‘/’ + dynamicPageID);

Yeah!
that looks more like it.

I’ve changed the URL as well,

Clicking on the link in preview mode, the page returns a 404
and the preview mode of the editor freezes, can’t get back to editor.
BTW In console I noticed it reloads the code for search results page

Tested it on live version as well, synced all collections, but here also 404.
Hmmm…clueless

What’ the full URL that you are trying to link to ?

The link structure I’m using is collectionID / Title

What’ the full URL for the webpage that you are trying to link to ?

Go to the webpage and copy the URL from the browser window

I’ve dynamic page, (Title=test).
CollectionID is standpunten.

Search results, entered Test, shows items of Test page,
collection standpunten,
as shown in screenshots.

URL of this page is:
https://mywebsite.com/standpunten/Test

Ok so you are using the Title as part of the URL and not the _id.

I can’t load that webpage so it must not be published.

Anyway for that URL format, code as follows:

import wixLocation from ‘wix-location’;

$w.onReady( function () {

// change container1 and dataset1 IDs as necessary for your site.

$w(‘#container1’).onClick((event) => {

    $w("#dataset1").onReady(() => { 

//get ID for repeater item when clicked
let $item = $w.at(event.context);
let currentItem = $item(“#dataset1”).getCurrentItem();
let dynamicPageID = ${currentItem.title}
let collectionID = ${currentItem.databaseName}

//re-direct to dynamic page with URL + repeater item ID

       console.log('https://mywebsite.com/'+collectionID+'/'+dynamicPageID); 

       wixLocation.to('https://mywebsite.com/'+collectionID+'/'+dynamicPageID);  



    }); 
}) 

})


It Works!!!

YES!!!

Oh i’m so excited!!!

Thank you so much Mike!
Speechless…

No problem

Hi! I’m trying to link dynamic pages to search results in my table.
bidirug .co .il/ home-1 (remove spaces from link)
For example, you can search for the value “צוקים” in the table. Then, when clicking on the result row, I expect this page to open:
bidirug .co .il/ service-company-1/ צוקים (remove spaces from link)

I’ve used the code provided in another discussion. I’m having trouble with the dynamic link format that should be inserted in the following code. I tries several several variation but keep getting the error “undefined link”:

export function resultsTable_rowSelect(event) {
 let rowData = event.rowData;
 let rowIndex = event.rowIndex;
 const myRow = event.target.rows[rowIndex];
    wixLocation.to(`${myRow[link-myDynamicPage-_id]}`)
}

Below is attached to format of my dynamic links:

Please help, Thanks!