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

2 issues with close on click and click event not working sometimes #23

Open
avitavdi opened this issue Nov 24, 2014 · 1 comment
Open

Comments

@avitavdi
Copy link

Hi, im using the datepicker for my project it looks very nice, thanks for the hard work.
i have encountered 2 issue with the datepicker:

  1. after setting the date using $(selector).datepick('setDate', date);
    clicking the input element does nothing, only after sometime i can reuse the datepicker.
    i use 2 datepickers to present date range, i allow selection only of 1 week, if one chooses 11/26/2014 (in any of the date pickers) the range will be 11/24/2014 - 11/30/2014.
    after the choice the datepicker i choose from doesnt work (when i click the inuput element nothing happens) only after like 10 seconds it available again.

2.clicking on iframe does not close the datepicker, only if i click outside the iframe, it closes it.
the datepicker is on the page not in the iframe..

Thanks!

@avitavdi
Copy link
Author

after some investigation it looks like setDate doesnt close the datepicker, so when i click on the input element nothing happens because the datepicker thinks its already open, if i move to another tab and return the datepicker apears again with me clicking on the input which proves my point.
In addition when it happens i i press somewhere else on the screen and then again on input it opens again.
i did some ugly workaround without going into the code (maybe i'll do it later).
in the on select event function i did the following:
$.datepick.hide(this);
$(this).one('click', function(ev){
$.datepick.show(this);
})

It forces the datepicker to close and opens it again once i click the input.

The issue might be caused due to the fact im using setDate inside the onSelect function since if a date picked, for example 11/26/2014 then i will set it to 11/24/2014 which is the start of the week.
i prevent infinite loop by checking if the current set date is the same as the start week date.

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

No branches or pull requests

1 participant