Bug? Calendar Dynamic Show Attribute based on toggle does not toggle visibility

Hello Fellow Wapplers,

I have a calendar with dynamic events from multiple sources. I’d like to hide/show events from a source based on whether or not the user needs to see events from a certain calendar.

I have a dynamic calendar with a Dynamic Show attribute:
image

The show condition is:
varShowCounselorCal.value == 1

varShowCounselorCal is a Variable with a default of 0.

When the calendar loads it correctly shows the default events:

Clicking the “Show Counselor Calendar” button sets:
varShowCounselorCal.value == 1
It also sets the button state as active.

Button logic:

varShowCounselorCal.value == 0 ? 1: 0

When the user clicks on this button again, it sets:
varShowCounselorCal.value == 0
It also removes the active button state

As shown, the event from the calendar whose Show condition is:
varShowCounselorCal.value == 1
Is still appearing.

My understanding is that since the calendar Show condition is not met. The Calendar and its corresponding events should not display.

At this point, I’m not sure if this is a bug or a misunderstanding on my behalf of how things are supposed to work. If it’s a bug, I can provide an official bug report.

I’m not sure about what is in the background stopping it from doing what you want however as a workaround, I think you could use the ternary statement on the source array:

say the source was SC_bookings.data.items you could have the source set to:
varShowCounselorCal.value ? SC_bookings.data.items : 0
That way the source for the calendar entries will either be the source you want when the value is 1 or 0 (so no repeat) when the value is 0

I haven’t tried it but should work :crossed_fingers:

Thank you! That works nicely (with a slight modification to the code for posterity’s sake). Once I can conclusively determine if this is a bug or not, your answer will be the solution.

The code is:
varShowCounselorCal.value == 1 ? SC_bookings.data.items : null

I’ll proceed with this. However given that you seem to agree that the initial Show logic should work as expected… I think this may be a bug.

Perhaps others will weigh in.

1 Like