Hi there!
On a Dynamic page I want to hide a section on the page when a database field contains a specific value. I tried to achieve this with the below code. To be more specific, I want to achieve that if in "Dynamicdataset" field "type" contains value "TRANSPORTATION / FLIGHT", section 274 is hidden.
The code is not working, could somebody point me in the right direction? I would really appreciate it!
Best regards,
Stefan
import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; import wixData from 'wix-data'; import wixWindow from 'wix-window'; /** * Adds an event handler that runs when the dataset is ready. */ export function dynamicDataset_ready() { $w("#dynamicDataset").onReady( () => { let itemObj = $w("#dynamicDataset").getCurrentItem(); if(itemObj.type === "TRANSPORTATION / FLIGHT") { $w("#section274").hide(); } } ); }
You have 2 dataset.onReady nesting in each other. That's wrong.
You should only have 1 dataset,onready.