-
Notifications
You must be signed in to change notification settings - Fork 49
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
bypass events to jQuery UI Datepicker #25
base: master
Are you sure you want to change the base?
Conversation
…s in parents with .blockMsgClass jQuery UI Datepicker creates its calendar at the end of the document (mostly outside an active modal jqm dialog) which disallows to change the year (select) in a modal jqm. The solution was found in <http://stackoverflow.com/a/18188375/2627857> and adopted for jqModal. This allows two solutions: 1. add `blockMsg` css class to the datepicker div 2. or set the (new) jqm option `blockMsgClass` to '`ui-datepicker`' Both settings allow the focus event for the year select to bypass the "Focus Examination Function".
Thank you kindly for the patch! I will review and package a release ASAP On Mon, Apr 25, 2016, 3:52 AM Dominik Pesch [email protected]
|
Thanks for your answer. I've just fixed a little typo |
@@ -356,6 +363,7 @@ | |||
* (Function) onShow - User defined callback function fired when modal opened. | |||
* (Function) onHide - User defined callback function fired when modal closed. | |||
* (Function) onLoad - User defined callback function fired when ajax content loads. | |||
* (String) blockMsgClass- User defined exclusion parent class which are allowed to get focus even outside the active modal (like the jQueryUI datepicker) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dpesch lets call this modalAllow
instead of blockMsgClass
-- and support (Mixed) instead of a (String) class. -- This way we can use .closest (https://api.jquery.com/closest/) which is faster and suppports a string match, an element, or collection.
e.g.
// original support
$(e).jqm({modal: true, modalAllow: '.blockMsg'});
// or more flexible support
$(e).jqm({modal: true, modalAllow: '#blockMsg'});
$(e).jqm({modal: true, modalAllow: document.getElementByID('blockMsg')}); //etc. then....
// override modal behavior if modalAllow is provided and matches target or an ancestor of target
if (activeModalOpts.modalAllow && $target.closest(activeModalOpts.modalAllow).length > 0) {
return true;
}
@dpesch Thanks again for this. I made a few suggestions. Let me know if you'd like to implement them -- or I can merge as-is and make corrections. |
@dpesch did you like the idea to call the property I can merge your work and refactor to the above -- or let me know if you prefer to do the work. Thanks! |
I very much apologize, I haven't seen your reactions. closest() should be work great and modalAllow should be much more understandable. Thanks for your support! |
The following patch allows to bypass events/focus to elements outside of an active modal. This happens when you use a jQuery UI Datepicker in a jqModal overlay with
modal: true
. Then the year could not be changed any more, because the select won't be able to get the focus.I've found the problem and solution here: http://stackoverflow.com/a/18188375/2627857 and adopted it for jqModal.
We call our modal now like this:
which allows us to use the ui-datepicker inside the modal. It would be very kind if you could accept or implement it in jqModal. Sorry for my rusty english