im-perativa / streamlit-calendar

A Streamlit component to show calendar view using FullCalendar
https://calendar-component.streamlit.app/
Apache License 2.0
101 stars 10 forks source link

Adding eventClick functionality #24

Closed jovi-s closed 6 months ago

jovi-s commented 7 months ago

Hi, I am trying to add eventClick functionality such as: https://fullcalendar.io/docs/eventClick-demo

to the streamlit-calender component using the following calender_options:

calendar_options = { "headerToolbar": { "left": "today prev,next", "center": "title", "right": "resourceTimelineDay,resourceTimelineWeek,resourceTimelineMonth", }, "slotMinTime": "06:00:00", "slotMaxTime": "18:00:00", "initialView": "resourceTimelineDay", "eventClick": { "event": { "title": 'my event', }, "view": { "type": 'my event view', } }, }

however, this does not produce the resulting effect of viewing the calender event/ information upon eventClick.

I'm looking for your support on this matter. Thank you.

im-perativa commented 6 months ago

Hi @jovi-s . eventClick functionality is enabled by default (check demo at https://calendar-component.streamlit.app/ and try to click an event).

image

Keep in mind that the callback usage in streamlit is different per this guide.

The example app from the template shows how bi-directional communication is implemented. The Streamlit Component displays a button (Python → JavaScript), and the end-user can click the button. Each time the button is clicked, the JavaScript front-end increments the counter value and passes it back to Python (JavaScript → Python), which is then displayed by Streamlit (Python → JavaScript).

So if you want to add some action in streamlit based on the callback value you need to implement it in streamlit logic.