I have three databases, which I use for dynamic pages.
Articles, Interviews, Reviews
Repeater = repeaterResults
Dataset articles= dataset10
On the search result page, I have connected a repeater to one dataset; articles.
When I perform a search I end up at this search result page (Thank you CodeQueen)
I run a search query to search for a word in all the three databases, and various fields.
I’m able to present results of all the databases in the repeater, using Concat.
This works perfectly (so far).
In the repeater I’ve added a button (button1) which I want to link to the corresponding (dynamic) page, but now I’m stuck. I need to connect this button, but can’t use the repeater/dataset connection.
How do I connect this button to the according page,
and if I need a specific line of code, where to put it?
Your help is much appreciated!
My code:
import {local} from 'wix-storage';
import wixData from 'wix-data';
$w.onReady(function () {
var sameWord = local.getItem("searchWord");
$w("#searchBar").value = sameWord;
$w("#searchBar").placeholder = sameWord;
$w('#dataset10').onReady(function () {
search();
});
});
export function searchButton_click() {
search();
}
function search() {
wixData.query('Articles')
.contains('title', $w("#searchBar").value)
.or(wixData.query('Articles').contains('paragraph1', $w("#searchBar").value))
.find()
.then( (results1) => {
let Results1 = results1.items
wixData.query("Interviews")
.contains('title', $w("#searchBar").value)
.or(wixData.query('Interviews').contains('paragraph1', $w("#searchBar").value))
.find()
.then( (results2) => {
let Results2 = results2.items
wixData.query("Reviews")
.contains('title', $w("#searchBar").value)
.or(wixData.query('Reviews').contains('introtext', $w("#searchBar").value))
.find()
.then( (results3) => {
let Results3 = results3.items
$w("#repeaterResults").data = Results1.concat(Results2, Results3)
$w("#repeaterResults").expand();
} );
} );
} );
}
Hi
I am building a dynamic app for a client and integrating with airtable. For now, airtable is irrelevant, but it will populate 3 datasets in WIX.
City
Restaurants
Offers
The app will first read the city, then list the restaurants in that city and then read the offers (could be multiple offers per restaurant) for that restaurant.
We could combine city and restaurants into one database but offers should be different as it will have the restaurant name and multiple offers and offer types.
I cannot see a way to link multiple databases to a repeater. I've checked online, the forums and velo sites but cannot see that this is possible with or without coding.
has anyone managed to connect multiple databases to repeaters?
thanks
Mims
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!
No problem
It Works!!!!
YES!!!!!!!!!!!
Oh i'm so excited!!!!!!!!!
Thank you so much Mike!
Speechless.........
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
The link structure I'm using is collectionID / Title
What' the full URL that you are trying to link to ?
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
Ok so that's no good as it is not the URL that you require.
Try console.log('/'+collectionID+'/' + dynamicPageID);
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
like this
wixLocation.to('https://google.com');
Ok. Changed it too Google.com temporary.
Hope I did it correctly.
But no result.
Yes. I did as well.
No difference.
Yep.
When I click on the container of the repeater, nothing happens.
I'm so sorry Mike.
You're right.
I've removed the underscore.
Now the collection name is logged an recognised.
But link (container) is still not working.
What am I missing?
databaseName is listed as a field key for that item so we should be able to read it, must be an issue in the code. Can you send a pic for line 89 of your code
Thanks again Mike, for your help.
hmm. Tough Cookie for me as a designer.
but want to crack it.
I've added the databaseName field (text) at the collections, and it shows up in console.log.
Tried also lowercase or uppercase of populated field in collection. Article vs article (in this field in Article collection). But collectionID remains undefined in log.
PageID log returns to number
Also tried to manually enter pageID after section in browser,
f.e. ..../article/746b8866-8f21-4921-88ce-801a37912c0a
but this gives a 404 page not found.
All the right information and elements of the dynamic page I want to link to however shows up in log (wow!).
Like title field, text fields etc.
Including the actual link setup of the pages: link-article-title, or link-interview-title.
So you would say that linking to this page must be possible.
I Hope you see a way out.
Kind regards,
Tanya