Datepicker , disable dynamically dates.
hi,
i need to disable specific dates into the datepicker. The problem is that the list date to disable is dynamic and directly depends on user action.
In my scenario i'm working on a room reservation app, the user chose a room and then i receive a list of 'already booked date' tha i need to disable in the datepicker.
the disabled date only appears if i change the month (that force the datepicker to rcall adin the disalbing function). Is it possible to manually trigger the datepicker to check again dates ?
Hi @Ostro. Probably we should move the refill method in the controller, so you can hook on it.
Right now you cannot trigger a "refresh" programmaticaly.
I would like to see this functionality as well. Similarly, I want to disable dates dynamically, but I want to pre-disable dates as the calendar is built out, by filtering through an existing data store of 'dates' and tagging dates appropriately if there is an event on that day.
HI @bekos, I was looking at the code for 0.7.0 and I don't see this as part of the datepicker section. Is there a reason for that?
Has this been enabled in the current release? I'm looking for this functionality as well, and had changed the code myself to allow it, but it was (naturally) overridden as I updated to version 0.9.0.
The 7f4b40eb8bc57f03bd306330a6ad227790c33f27 exposes the refill method on the controller. You can easily wire any custom logic to refill the datepicker anytime you want, and so to re-evaluate the disabled dates.
Hi Bekos i have the same issue as mentioned by Ostro can u give an example of the change to implement in my datepicker so that it disables all the dates properly
+1 need example. In documentation there is nothing about property date-disabled
@getuliojr Actually, there is something in the demo, but it's currently broken! I will fix this asap.
@poojash You should create another directive that will require datepicker's controller. From your directive you should call the refreshView of the datepicker to reevalute the disabled dastes.
If you want you can create a plunker to see if I can help further.
@bekos Just wanted to remind you that the examples are still broken. Is the changes in syntax documented anywhere?
+1 Is it possible to have working example on this in near future??
Looks like the demo is working fine for date-disabled in popup type of calendar. However I am looking for disabling dates coming from server. I think last comment from bekos to poojash is the solution for the issue. Will try it out and share if I got any success.
+1 for example, even if only in plunker here
Been struggling with this as well, plunker example with dates to disable from server-side would be greatly appreciated.
@bekos Please, give us an example, I can't refresh disabled dates in a range
@antenko I actually wrote both a question and an answer for this exact issue just recently http://stackoverflow.com/questions/24985387/disable-dates-using-factory-response-ui-bootstrap-datepicker/26226210
I would like to be able to refresh the popup version of the datepicker; I'm having difficulty getting the example from @klintan to work for the popup with a $watch.
Also fought with trying to get a $watch to refresh a datepicker popup...
Settled on using an event as a workaround:
https://gist.github.com/cgmartin/3daa01f910601ced9cd3
My! Please add a convenient way to refresh the datepicker popup. cgmartin's workaround looks good. (Big thanks.) But we should make it easier than that.
+1 datepicker-popup solution.
+1