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();
} );
} );
} );
}