Create a search bar and drop-down filter for a dynamic page

Hi!

I have been using the following code for a search bar and a drop-down filter on my site for filtering my datasets and it has been working fine. But now I’ve decided to put all the data into one dataset and create dynamic pages. As I expected the code I’ve been using now show all the data from dataset when filtering and searching instead for only the results I already have filtered when creating a dynamic page. What string do I have to add to my code for only search for results in the dynamic page? Grateful for all help!

import wixData from ‘wix-data’;

$w.onReady(() => {
})

let debounceTimer;
export function input1_keyPress(event) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
$w(“#dynamicDataset”).setFilter(wixData.filter()
.contains(“title”, $w(“#input1”).value))
}, 500);
}

export function dropdown1_change(event) {
$w(“#dynamicDataset”).setFilter(wixData.filter()

.contains(“lan”, $w(“#dropdown1”).value))
}

you need a column in your collection to identify which dynamic page each line of data belongs to, then you just add that column to your filter.

Thanks! I’m a beginner so sorry for not really following. I have such column, I guess it is the same that is needed for creating dynamic pages? Where in the code am I supposed to add the name of the column?

@rebecka Did you manage it at the end? I am having kind of the same issue. Any insights?

@media53537 No, sorry :(. Still using my old regular pages instead of the dynamic pages…

Having same problem
Pls give a solution.

Hello again buddy.

You are now long enough here in this forum, to know how it’s working.
You should better open your own new post, with your own issue.
You can link this page in your own post, to show examples.:wink: