I've read all of the other posts on here regarding search box and drop down filter a database result to a repeater. I have done this where the results show up on a table with success, but for some reason I am having issues accomplishing this with the repeater. I will post what I have, perhaps I have overlooked something.
import wixData from 'wix-data';
let originalPropertiesInfo = [];
export function button1_click(event, $w) {
//Add your code for this event here:
wixData.query('jobs')
.contains('company', $w('#searchbox').value)
.or(wixData.query('jobs')
.contains('jobTitle', $w('#searchbox').value))
.or(wixData.query('jobs')
.contains('neighborhood', $w('#searchbox').value))
.or(wixData.query('jobs')
.contains('hours', $w('#searchbox').value))
.or(wixData.query('jobs')
.contains('description', $w('#searchbox').value))
.find()
.then(results => {
originalPropertiesInfo = results.items;
$w('#repeater2').data = originalPropertiesInfo;
});
}
The idea is to be able to search a job board by filtering by city and then searching by keyword. I haven't attempted to code the dropdown search yet because I'm still trying to figure out why my searchbox won't work. Thank you.
Hi,
we have a new capability coming up, allowing you to add 'distinct' result capability on your data base queries
Shlomi
i'm working on something identical and also looking for a similar solution. thanks
Anybody ever find a way to get rid of the duplication that results in a dropdown menu used for repeater search?
Hi did you ever get a resolution to this issue?
Hello Jared,
Assigning the results object to the repeater data is not enough to apply it.
See more here: https://www.wix.com/code/reference/$w.Repeater.html#data
https://www.86vacancy.com/jobboard it should be good to view
When I click the submit button, all of the items are included regardless of the filter... Its under a members only, I'll unlock it right now and post the URL if you'd like to look.
Your code looks valid. When you say your code does not work, what do you see happening?
The repeater is empty? Or does it include all the items regardless of the filter?