autoclose() should trigger datepicker-apply#258
autoclose() should trigger datepicker-apply#258multiwebinc wants to merge 3 commits intolongbill:masterfrom
Conversation
When `autoclose` is set to `true`, there is no way to listen to an event where the second date is chosen specifically by the user. If you bind to `datepicker-change` this is also triggered when changing the date programatically using `setDateRange()`, so you can't differentiate between this and being changed by the user. It makes sense to me that `autoclose` should also auto-apply.
|
Thanks, can you provide an example of its use in https://github.com/longbill/jquery-date-range-picker/blob/master/index.html? And I noticed a bit of code-duplication now occurs: https://github.com/multiwebinc/jquery-date-range-picker/blob/1f156bff8e20cb762361fbb52fb98769dd29f0d4/src/jquery.daterangepicker.js#L920-L930 Might it be possible to use triggerApply() here as well? |
|
@holtkamp You are right about the duplicate code. I've updated the PR. However I don't know if it's really necessary to provide an example of its use. There's already: That's basically how it's used. Just that before this function would not be triggered if |
|
On second thought I updated the comment in index.html to better reflect the functionality |
When
autocloseis set totrue, there is no way to listen to an event where the second date is chosen specifically by the user. If you bind todatepicker-changethis is also triggered when changing the date programatically usingsetDateRange(), so you can't differentiate between this and being changed by the user. It makes sense to me thatautocloseshould also auto-apply.