Hi,
I’m trying to build a real estate listing platform that allows the user to filter our properties by many criteria, including bed & bathroom number, city, state, country, listing price, listing type (house, apartment etc), listing status (active, pending & sold), as well as other things such as properties that are waterfront, mountain view etc.
I’m able to get a price between to work as well as bath and bed number, but I cant get certain filters to work together.
For example, the user can select a certain price range, but as soon as they select a Listing type (house, apartment, etc) the repeater displays all listings of that type regardless of price.
So, how can I get them to all work together. I’m open to all suggestions regarding the type of code I’m using and/or the user inputs I’m using to get information from the repeater.
Know that I’m fairly new to coding and Corvid but I can usually work my way through most things.
Here’s my code that I’m using:
import {wixData} from ‘wix-data’ ;
$w.onReady( function () {
});
export function button9_click(event) {
let price = $w( “#slider4” ).value
let price2 = $w( “#slider3” ).value
$w( "#dataset1" ).setFilter(wixData.filter()
.between( 'price' , price, price2)
.ge( "bedooms" ,$w( '#dropdown8' ).value)
.ge( "bathrooms" ,$w( '#dropdown6' ).value)
.contains( "country" , $w( '#dropdown9' ).value)
.contains( "city" , $w( '#input4' ).value)
)
}
export function selectionTags1_change(event) {
let statusTypeValue= $w( “#selectionTags1” ).value
$w( “#dataset1” ).setFilter(wixData.filter().hasSome( “status” , statusTypeValue))
.then(() =>{
$w( “#text85” ).show();
})
}
export function text85_click(event) {
$w( “#dataset1” ).setFilter(wixData.filter())
.then(() =>{
$w( “#text85” ).hide();
})
}
export function selectionTags2_change(event) {
let statusTypeValue= $w( “#selectionTags2” ).value
$w( “#dataset1” ).setFilter(wixData.filter().hasSome( “propertyTypeTags” , statusTypeValue))
.then(() =>{
$w( “#text88” ).show();
})
}
export function text88_click(event) {
$w( “#dataset1” ).setFilter(wixData.filter())
.then(() =>{
$w( “#text88” ).hide();
})
}
I’m using selection tags for the listing type and listing status, because I couldn’t find a way to do it differently, additionally, I included the “text 85” and “text88” events to reset the filter as a work around. Id be happy if there were a better solution.
Here’s a link to the page:
https://matthew3663.wixsite.com/mysite-1/rentals
I have searched through many other posts, forums and videos trying to find a solution, and they are either dealing with a different situation tha I can’t seem to glean any info from, or they are vague and rely on the reader to have a command knowledge of corvid and coding, which I dont.
Please help if you can.
Thanks,
Matthew