Custom searchBar

Hi there. I created search for my users to be able to search what they posted easily from their dashboards. But the problem am encountering is that, even though I set the dataset to only display items posted by the user, when a user searches something, the results displays similar items posted by other users. and that is very insecure and I want your help to make sure that I can allow users to search everything and search only what they posted.

Thank you

Hi Spark, I have two dropdown but the problem is I do not get any answer, because I should need a button to filter. Here is my wix code if can help.

import wixData from ‘wix-data’;

$w.onReady( function (){
uniqueDropDown1();
});

function uniqueDropDown1 (){
wixData.query(“SoCollection”)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(‘#dropdown1’).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items){
const titlesOnly = items.map(item => item.soCategory);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList){
return uniqueList.map(curr =>{
return {label:curr, value:curr};
});
}
}

export function dropdown1_change(event, $w){
uniqueDropDown2();
$w(“#dropdown2”).enable();
}

function uniqueDropDown2 (){
wixData.query(“SoCollection”)
.contains(“soCategory”,$w(“#dropdown1”).value)
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w(‘#dropdown2’).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items){
const titlesOnly = items.map(item => item.section);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList){
return uniqueList.map(curr =>{
return {label:curr, value:curr};
});
}
}

1 Like