Closed jarodium closed 4 years ago
Hello! You can use the beforeShowDay
callback - see the docs. Feel free to reply to this thread or reopen it if you feel that this does not satisfy your use case.
Hello @monovertex My use case is that I need to keep the calendar updated once every 5 seconds and let the user know right away.
I use Ajax to make the requests. At this time, i'm setting up a global variable that keeps the new dates but, since beforeShowDay
only triggers when I go to another month. The currently viewed month does not rerender even if the global variable contains a date for it do disable. This is quite "dirty" to do and has it's drawbacks, especially when using in a "restaurant table booking system" when there is a need to check if the restaurant is full for a given day.
Hence the need to having a setDisabled
dates API method.
What do you think about having an API method to trigger a redraw of the calendar? Basically you still use beforeShowDay
to disable dates, but force a redraw of the calendar whenever your data updates and beforeShowDay
handles the actual disabling logic.
This way we keep things pretty abstract and a minimal and re-usable API, as a method to set disabled dates is pretty specific and would increase the complexity of the plugin unnecessarily.
Actually, looking through the codebase, we already have a method for that, redraw. It's just not documented, sorry about that.
What do you think about this solution?
Hi @monovertex Looks good and will fit my current use case. Will try it out as soon as possible and give feedback
Hello
I would like to leave the suggestion of having the ability to set disabled dates via API. This way I can keep the calendar always updated.