Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoclose() should trigger datepicker-apply #258

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

multiwebinc
Copy link
Contributor

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.

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.
@holtkamp
Copy link
Collaborator

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?

@multiwebinc
Copy link
Contributor Author

@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:

.bind('datepicker-apply',function(event,obj)
{
    /* This event will be triggered when user clicks on the apply button */
    console.log(obj);
})

That's basically how it's used. Just that before this function would not be triggered if opt.autoClose is true (or opt.showTopbar is false, which sets opt.autoClose to true).

@multiwebinc
Copy link
Contributor Author

On second thought I updated the comment in index.html to better reflect the functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants