Page setup
dataset1: display country
dataset2: filter by dataset1, selected country, show the certificate name.
dataset3: link to a new dataset to save the value inputted on the screen.
dropdown1: link to dataset1 to display the country value
dropdown1: link to dataset3 to save the search criteria.
repeater1: display the filtered result of dataset2.
button1: Submit button, link to dataset3 submit action
button2: Search button, click on the search button, and then repeater started to filter
If I set the coding for button 1 click action:
I would get the error , fail to filter the value for submitted action.
I changed to button2 click action,.
the search button do not have any response.
Here is my coding:
import wixData from “wix-data” ;
$w . onReady (() => {
// loadCountrys();
});
let lastFilterCountry ;
let debounceTimer ;
export async function button2_click ( event , $w ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
$w ( ‘#dataset1’ ). setFilter ( wixData . filter (). contains ( “country” , $w ( ‘#dropdown1’ ). value ))
. then (()=>{
console . log ( “Dataset is now filtered” );
})
. catch (( err )=>{
console . log ( err );
$w ( ‘#repeater1’ ). expand ();
})
}
export async function dropdown1_change ( event , $w ) {
// This function was added from the Properties & Events panel. To learn more, visit Velo: Working with the Properties & Events Panel | Help Center | Wix.com
// Add your code for this event here:
if ( debounceTimer ) {
clearTimeout ( debounceTimer );
debounceTimer = undefined ;
}
debounceTimer = setTimeout (() => {
console . log ( $w ( ‘#dropdown1’ ). value );
wixData . filter ( $w ( ‘#dropdown1’ ). value ) }, 500 );
}