I have tried this various ways and finally I moved the code from the onReady function to being executed by a button. As soon as the setFilter is called all of the user input fields on the form get set to read-only and still the data on the form doesn’t change. The information looks as follows:
When the following code runs:
export function button2_click(event) {
console.log("button2_click called");
let eventId=session.getItem("CurEventID");
console.log("button2_click, eventId="+eventId);
$w("#EventsDataset").setFilter(wixData.filter()
.eq("eventId", "eventId")
)
.then( () => {
console.log("dataaset setFilter was successful");
})
.catch( (err) => {
console.log("setFilter error encountered, err="+err);
});
I get the following results in the developers console log:
button2_click called Event Detals Line 91
button2_click, eventId=e5dcbd3c-d40d-41fa-864b-92ea44894650 Event Detals Line 93
An error occurred in one of currentIndexChanged callbacks Error: Variant “Error” not covered in pattern. This could mean you did not include all variants in your Union’s matchWith function. For example, if you had this Union: const Operation = union({ Add: (a, b) => ({ a, b }), Subtract: (a, b) => ({ a, b }), }) But wrote this matchWith: op.matchWith({ Add: ({ a, b }) => a + b // Subtract not implemented! }) It would throw this error because we need to check against ‘Subtract’. Check your matchWith function’s argument, it’s possibly missing the ‘Error’ method in the object you’ve passed.
dataaset setFilter was successful
Since I am not calling currentIndexChanged or matchWith I assume it must be something with the setFilter or the wixData.filter entries but I am calling them exactly the same as shown in the Wix Code API page for setFilter. Can anyone see a difference in what I am doing?