I am trying to implement a user input filter which has the ability to filter based on two different fields (title & type to enable a full filter of all fields), I have tried the code listed below while I am getting no errors and I am able to successfully filter using the first field title however when i search for an item in my next field type the screen returns no records only a blank field . If anyone can lend me any assistance I would be grateful
See code below : -
// For full API documentation, including code examples, visit http://wix.to/94BuAAs import wixData from 'wix-data'; // For full API documentation, including code examples, visit http://wix.to/94BuAAs $w.onReady(function () { //TODO: write your page related code here... }); export function filterButton_onClick(event) { $w("#dataset1").setFilter(wixData.filter() .contains("title", $w("#filterInput").value) .or(wixData.filter() .contains("type", $w("#filterInput").value) ) ) } export function button1_click(event, $w) { $w("#dataset1").setFilter(wixData.filter("all")); }
Thanks that was going to be another question , smh
Hi,
I am not sure about your specific setup, but this part is incorrect:
export function button1_click(event, $w) { $w("#dataset1").setFilter(wixData.filter("all")); }
If I understand the purpose of this code correctly, you are trying to 'reset' the filter.
To reset the filter, use this line:
$w("#dataset1").setFilter(wixData.filter());