I just transfer the site from wix to editorX and stupid me not checking all aspect in the website. I don’t have knowledge at coding but sometime ago managed to connect bit and pieces of of code and combine them to get the real estate custom search bar in Wix, but now the code won’t work in editor X at all. I don’t know what went wrong, can anyone point me to some direction, I would be grateful. Thank you.
import wixData from ‘wix-data’ ;
export function buttonSearch ( event ) {
search ();
}
function search ( ) {
wixData . query ( "HouseListing" )
. contains ( "province" , String ( $w ( "#dropdown1" ). value ))
. and ( wixData . query ( "HouseListing" ). contains ( "housetype" , String ( $w ( "#dropdown2" ). value )))
. and ( wixData . query ( "HouseListing" ). between ( "price" , parseFloat ( $w ( '#dropdown3' ). value ), parseFloat ( $w ( '#dropdown4' ). value )))
. find ()
. then ( results => {
$w ( "#repeater1" ). data = results . items ;
});
}
//Reset Filter
export function button11_click ( event ) {
$w ( "#dynamicDataset" ). setFilter ( wixData . filter ())
$w ( "#dropdown1" ). value = **undefined** ;
$w ( "#dropdown2" ). value = **undefined** ;
$w ( "#dropdown3" ). value = **undefined** ;
$w ( "#dropdown4" ). value = **undefined** ;
$w ( "#searchBar" ). value = **undefined**
}
let debounceTimer ;
export function searchBar_keyPress ( event ) { //enable onKeypress for input form
$w ( "#searchBar" ). value
if ( debounceTimer ) {
clearTimeout ( debounceTimer );
debounceTimer = **undefined** ;
}
debounceTimer = setTimeout (() => {
filter ( $w ( "#searchBar" ). value ); //ID of input form
}, 200 );
}
let searchWord ;
function filter ( search ) {
if ( searchWord !== search ) {
$w ( “#dynamicDataset” ). setFilter ( wixData . filter (). contains ( ‘title’ , search )
. or ( wixData . filter (). contains ( 'address' , search )
. or ( wixData . filter (). contains ( 'housecode' , search )))); // ID of the dataset
searchWord = search ;
}
}