Hi,
I need to be able to have a designated link for each filter i create from the dynamic dataset in a repeater.
Reading through the wixLocation Api , I have been playing around with the following code:
wixLocation.queryParams.add({ "key1": "pack"})
But I haven't been able to create a link that calls that filter in the repeater, it automatically loads the whole dataset.
my dataset is : "#Search"
the column being filtered : "#tag1"
the value for the code below is: "#pack"
The code for the "#pack" filter is below:
let collection1Records = [];
$w.onReady(function () {
$w("#packButton").onClick( (event) => {
//Query to get the information from the database
wixData.query("Search")
.eq("tag1","pack")
.find()
.then((results) => {
collection3Records = results.items;
//Set the information to the repeater
$w('#searchRepeater').data = collection1Records;
})
.catch((err) => {
let errorMsg = err;
});
$w('#searchRepeater').onItemReady(($w, itemData) => {
//Add here all the relevant elements of the repeater
//In this case, I've added a text and an image to the repeater
$w('#repeated1Title').text = itemData.title;
$w('#repeated1Description').text = itemData.description;
$w('#repeated1ManID').text = itemData.manId;
$w('#repeated1ManName').text = itemData.manName;
$w('#repeated1Logo').src = itemData.logo;
$w('#repeated1Image').src = itemData.image;
let linkToDynamicPage = itemData["link-search-title"];
$w('#repeated1Button').onClick(() => {
wixLocation.to(linkToDynamicPage);
});
wixLocation.queryParams.add({
"key1": "pack"})
});
});
});