can anyone help me ? why the first and second “if” not work correctly but the third and last is fine.
Your should write it differently (You have a mistake in your code). But first of all, I’m not sure the logic is right. Can you explain what you’re trying to do?
Try:
//insidi the onClick function:
let filter = wixData.filter();
if($w("#dropdown1").value === "any" && $w("#dropdwon2").value === "any"){
filter = filter.isNotEmpty("kategori").isNotEmpty("jenis");
} else if($w("#dropdown1").value === "any"){
filter = filter.contains("jenis", $w("#dropdwon2").value);
} else if($w("#dropdown2").value === "any"){
filter = filter.contains("kategori", $w("#dropdwon1").value);
} else {
filter = filter.contains("kategori", $w("#dropdwon1").value).contains("jenis", $w("#dropdwon2").value);
}
$w("#dataset1").setFilter(filter)
.then(///etc...
WOW it works,thank you. it help me a lot. btw i would like to ask if;
($w("#dropdown2").value === "any")
mean value of dropdown2 is “any” right, then what if i want to make value of dropdown2 is not “any” ? what symbol do i have to use ? sorry it my first time learning web developer/wix. i cant find any basic study in API reference. if u know where, i love to know it. thankyou
if($w("#dropdown2").value !== "any")
@jonatandor35 owh ok. thank you for your help. really appreciate it.
@yavierk You’re welcome