Hello,
How do display something like the below on my page after the user has searched my database page?
2,582 results: Texas Houston Clear all
Hello,
How do display something like the below on my page after the user has searched my database page?
2,582 results: Texas Houston Clear all
I still need help with this one.
Update: I got the results text to work with the help of a couple of experts on here… Thank you!!!
I need my Category and City& State button to work with the result button.
so when a user selects category and or city and state from the drop down.
below the drop down fields will show:
Next I wanted to create a clear all button that will clear the search buttons… I think I have the clear all botton code. I need help with the interaction between the dropdown and buttons… I hope this makes sense.
Here is not current code:
import wixData from ‘wix-data’;
$w.onReady( function () {
$w(“#noResText”).hide();
});
export function searchbutton_click_1(event, $w) {
$w(“#dataset2”).setFilter(wixData.filter()
.contains("category", $w('#vendordropdown').value)
.and(wixData.filter()
.contains("cityState", $w('#cityandstatedropdown').value)
)
).then((results) => {
let count = $w(“#dataset2”).getTotalCount();
if (count === 0){
$w(“#noResText”).show();
}
if (count >= 1) {
$w(“#noResText”).hide();
}
console.log("Dataset2 is now filtered");
let numberOfResults = $w(“#dataset2”).getTotalCount()
$w(‘#searchcount’).text = String(numberOfResults);
console.log(numberOfResults);
}). **catch** ((err) => {
console.log(err);
});
$w(‘#Vendorlist’).expand();
}
Ok I got the buttons to work by connecting them to the dataset. 1 button is for category, the other button is for City& State. when I select an option from the drop down both buttons change. which is great… but I think I need a code to assist with the changing of the buttons. For example. when I select from the category drop down, and not the city and state drop down… the city and state button will still change to reflect a ( Houston, Texas for example) event though this is correct. I don’t want it to work if I do not choose a city and state from the drop down vise versa…
Any recommendation on a code I could use to fix this? please note my drop downs are not connected to my dataset, only the submit button is connected to my dataset. Everything else works prefect the way it is.
Thanks in advance for your time and help.
Update:
I figured out how to connect my drop down search box to my button without dataset. I have one issue
When I preview to test and change the drop down to a selection, my button changes to: (object, Object)
How do I fix this? What am I missing?
Below is the code that I am using for the change:
// update the label of ‘#FiltCatebutton’ to be the same as #vendordropdown
export function vendordropdown_change(event) {
let dropdownLabel = $w(“#vendordropdown”);
$w(“#FiltCatebutton”).label = String(dropdownLabel);
// show ‘#FiltCatebutton’
$w(“#FiltCatebutton”).show();
}