Hi!
I am getting more familiar with coding but this one is too complicated for me haha: I have a dynamic page, which shows a custom travel itinerary for my future clients.
Every dynamic page contains a repeater, connected to a database with travel segments. A segment can be a flight (showing e.g. a text element with the departure airport) or a hotel (showing e.g. a text element with the roomtype). The repeater shows all segments filtered for 1 particular client and 1 particular itinerary, in order of date (old to new). Every repeater item contains all possible elements from all types of segments and all elements are collapsed by default.
With the help of code I want to achieve: if database field “type” contains “TRANSPORTATION” than expand fields x, x and x.
I have a similar code that works to show full sections but it doesn’t work in a repeater. See below for this code:
$w.onReady(() => {
$w("#dynamicDataset").onReady(() => {
let itemObj = $w("#dynamicDataset").getCurrentItem();
if(itemObj.type.includes?.("TRANSPORTATION")){
$w("#section253").expand();
$w("#section256").expand();
$w("#section249").expand();
$w("#section257").expand();
$w("#section254").expand();
$w("#section258").expand();
$w("#section255").expand();
$w("#section248").expand();
$w("#section259").expand();
$w("#section260").expand();
$w("#section286").expand();
$w("#section285").expand();
$w("#section280").expand();
$w("#section279").expand();
$w("#section296").expand();
$w("#section295").expand();
}
} );
})
I really appreciate all advice available!
Best regards,
Stefan