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

Disabling Drag-and-Drop in Streamlit-Calendar: Need Assistance with Event Modification Settings #33

Closed Salan54 closed 1 month ago

Salan54 commented 2 months ago

I would like the user to not be able to modify the position of the slots via drag-and-drop.

I thought it was enough to set the "editable" variable in "options" to "false" to disable drag-and-drop... but it is not the case. It is still possible to move events by drag-and-drop. I also removed "eventChange" from the callbacks passed when calling calendar. It is still possible to manually move the slots...

What else should I do to make the streamlit-calendar respond only to user clicks without it being possible to interactively modify the events?

Thank you again for your help and this excellent component.

im-perativa commented 2 months ago

Hi @Salan54, please try

calendar_options = {
  "editable": False, # instead of "false"
}
Salan54 commented 1 month ago

Sorry, I missed your comment. Thanks a lot.

Salan54 commented 1 month ago

I have : calendar_options = { 'editable': 'False', 'navLinks': 'True', 'resources': [{...}], 'selectable': 'True', 'headerToolbar': {'left': 'today prev,next', 'center': 'title', 'right': 'dayGridDay,dayGridWeek,dayGridMonth'}, 'initialDate': '2024-05-01T00:00:00', 'initialView': 'dayGridMonth'} But, I'm still able to move the slots with drag-and-drop. I just need the user to be able to select a slot, that's it (hence 'selectable': 'True') What is wrong with these settings? Thanks for your help.

im-perativa commented 1 month ago

@Salan54 try to remove the quotes in 'editable': 'False' and change it to 'editable': False instead

Salan54 commented 1 month ago

@im-perativa That's it... Thanks a lot, and thank you for your patience