What is this —> let searchFromHomePage = + ‘1’ <— ???
The new style how to put a NUMBER into a variable ?
However, it doesn’t even matter, if you put a → NUMBER<–, or a → STRING ← into the → SESSION-STORAGE!
At the end you will get —> a —> STRING!
import wixStorage from 'wix-storage';
$w.onReady(function () {
let searchFromHomePage1 = 1;
console.log(searchFromHomePage1+" / "+typeof searchFromHomePage1);
wixStorage.session.setItem("searchFromHomePage", searchFromHomePage1);
let result = wixStorage.session.getItem("searchFromHomePage");
console.log(result + " / " + typeof result);
});
How to generate NUMBERS? →
let myNumber = Number("1");
How to generate STRINGS ? —>
let myString = String(1);
Try this one…
$w.onReady(function() {
$w("#propertiesDataset").onReady(() => {
//------------------------- declaration-process of variables--------------------------------------
let searchIndustry = session.getItem("industrySearch");
let searchCity = session.getItem("citySearch");
let searchStateProvince = session.getItem("stateProvinceSearch");
let searchFromHomePageResult = session.getItem("searchFromHomePage");
//------------------------- declaration-process of variables--------------------------------------
// ----------- filling of DropDowns -------------------------------------------
$w("#industry").value = searchIndustry;
$w("#city").value = searchCity;
$w("#stateProvince").value = searchStateProvince;
$w("#text200").text = searchFromHomePageResult;
// ----------- filling of DropDowns -------------------------------------------
if ($w("#text200").text === searchFromHomePageResult) {
let filter = wixData.filter()
if (searchStateProvince) {filter = filter.eq("stateprovince", searchStateProvince)}
if (searchCity) {filter = filter.eq("city", searchCity)}
if (searchIndustry) {filter = filter.hasAll("industry2", searchIndustry)}
$w("#propertiesDataset").setFilter(filter).then(() => {session.clear();});
}
});
});
Just the following one seems to be strange…
if ($w("#text200").text===searchFromHomePageResult){.....
Why not also directly …???
if (searchFromHomePageResult === "1"){......