I need to make Selection Tags search only one category and join what Input 1 contains as a value,
I managed to make them work separately but I need to join.
does anyone have an idea how i can do this?
export function input1_keyPress(event) { // seach
let alinhamento;
if (alinhamento) {
clearTimeout(alinhamento);
alinhamento = undefined;
}
alinhamento = setTimeout(() => {
filtro($w("#input1").value);
console.log($w("#input1").value)
$w("#textseach").text = $w("#input1").value; // show total results on a text
}, 500);
}
let ultimaPesquisa;
function filtro(pesquisa) {
if (ultimaPesquisa !== pesquisa) {
$w('#dataset1').setFilter(wixdata.filter() // set filter
.contains("nomeAba", $w("#input1").value)
.eq("visivel", true));
ultimaPesquisa = pesquisa;
//
var prevSelectedValue = null;
$w.onReady(function () {
let tags = $w('#caixaralho');
if (tags.value.length === 1) {
prevSelectedValue = tags.value[0];
} else if (tags.value.length > 1) {
tags.value = [];
}
if (!pesquisa.target.value || pesquisa.target.value.length === 0) {
pesquisa.target.value = [prevSelectedValue];
} else {
pesquisa.target.value = pesquisa.target.value.filter(x => x !== prevSelectedValue);
prevSelectedValue = pesquisa.target.value[0];
$w('#dataset1').setFilter(wixdata.filter() // set filter
.eq("filtrosloja", $w("#caixaralho").value)
.eq("visivel", true));
function createFilterThatMatchesAnyKeyword(selectedKeywords) {
return (selectedKeywords && selectedKeywords.length > 0) ?
// Filter content that fits any of the the selected keywords.
wixdata.filter().hasSome('filtrosloja', selectedKeywords) :
// When no keywords are selected, do not filter any content.
wixdata.filter();
}
let selectedKeywords = pesquisa.target.value;
let filter = createFilterThatMatchesAnyKeyword(selectedKeywords);
$w('#dataset1').setFilter(filter);
}
})
}
}
here is the complete code of one of the page
I know there must be complete chaos and it could be much less
but I’m happy with what I did
even if it’s not the best way
I accept help
Hello petriell0 Anima,
i think you will have to connect your repeater programmatically by corvid to achieve your aim. You are using two differerent search/filtering-functions, which do not communicate/work together.
You should first collect the results in an ARRAY(object) for example, and then pulling these collected results into the repeater.
Something in this direction, where you can for example input a second filter.
Something like that.
import wixData from 'wix-data';
$w.onReady(function () {load_Data()});
export function BTNsearch_click(event) {load_Data()}
function load_Data (parameter) {console.log("GO")
wixData.query("Companies")
.contains("column1", $w('#dropdown1').value)
//inputting a second filter here
.contains("column2", $w('#dropdown2').value)
.find()
.then( (results) => {
if(results.items.length > 0) {
let firstItem = results.items[0];
console.log(results.items)
$w('#repeater1').data = results.items
$w("#repeater1").onItemReady( ($item, itemData, index) => {
$item("#pic").src = itemData.logo;
$item("#ID").text = itemData.title;
$item("#group").text = itemData.companyGroup;
$item("#title").text = itemData.companyName;
// $item("#image1").onClick( (event) => {} );
});
}
else { }
})
.catch( (err) => {
let errorMsg = err;
});
}
worked perfectly
thank you very much!
I started programming in a few months so I’m learning
@petriell0anima
Yes i know ^^.
If you could integrate this, then you are already at an advanced programming-level.
Well done!
Do not forget to like it if you really liked it 
@russian-dima
hello i need your help again.
the 2 filters work perfectly
but even searching for any random word
that does not exist in the filter, it leaves one or all items visible.
for example:
the filter is configured to filter the input value with the tittle (names)
but searching for “mowakdfiujwanfiwandaj” in the input it still shows results
I didn’t want to move too much so as not to spoil the code
do you know if there is a way that when there are no results the repeater will just be blank, with no sample items?
I don’t know much about that part of the code in the image below because I never tried to do it
I used wixdata.filter and you used wixdata.query
@petriell0anima
You mean reset the repeater?
$w('#repeater1').data = []
@russian-dima almost that, I need to make sure that when the filter doesn’t find any results it doesn’t show anything.
an example of how it should be:
in a t-shirt store you search in the search tab “red t-shirt” and so it shows you several red t-shirts.
now in the same store you search on the search tab “iphone” and it doesn’t show any results because nothing was found.
what happens in my site is that no matter what I put
it can be several characters, it will put something
sorry to bother again
here a video example:
on the example site it says: “There are no ads that match your search”
if you don’t understand brazilian portuguese
Waht if you would use the reset in the ELSE-part?
if(results.items.length > 0) {
//...bla bla bla...
else {$w('#repeater1').data = []}
Or perhaps changing your FILTER-OPTIONS ?
From contains —> to eq ? or has Some ?
Try it out.
worked, thank you
I was trying to do this in the last 34 hours that I was in the editor and I still hadn’t managed
Thank you very much !
@petriell0anima
I am sure, other user will look into this post, and will be interessted into your solution.
Perhaps you should help them too, by telling what you did at the end to solve your problem😉.
Next time perhaps you visit my site
and take a closer look into my examples.
There you can find almost all my knowledge 
Link to find in my PROFILE.