I have a dataset that will be filtered in different situations. I’d like the flexibility to be able to use .then. ie:
onClick(){
TestFilter(1)
.then(() =>{
TestFilter(2);
});
So one sort doesn’t risk overriding the other. With the code below, I’m getting the following error: “An error occurred in one of currentIndexChanged callbacks DatasetError: could not resolve dynamic filter”. Other operations work fine if I substitute them for the setFilter code, but something about the promise seems to be breaking setFilter. Any ideas?
function TestFilter(){
return new Promise((resolve, reject) => {
console.log("passed return");
$w("#GroupClasses").setFilter(wixData.filter()
.eq("date", $w("#cDLog").value) button click
.eq("title", $w("#cTLog").value)
)
.then(() => {
console.log("Dataset is now filtered");
var count = $w('#GroupClasses').getTotalCount();
console.log(count + " items found");
console.log($w("#GroupClasses").getCurrentItem());
resolve("sorted")
})
.catch((err) => {
//$w("#empty").show();
reject("error message: " + err);
});
});
}