Comments (9)
How is the datepicker currently initialized? Using jQuery.ready?
from turbolinks-classic.
No, it just runs. and sets initialized = false;
If initialized = false it recreates the date picker div. If initialized = true, .datepicker() on an object will not create the div.
It's kinda lazy initialized.
On Oct 5, 2012, at 9:56 AM, David Heinemeier Hansson [email protected] wrote:
How is the datepicker currently initialized? Using jQuery.ready?
—
Reply to this email directly or view it on GitHub.
from turbolinks-classic.
Also,
I looked into firing document.ready() as an event for jQuery, but unfortunately jQuery removes the events from the event listener as they are fired from the ready event. So there is no way to re-fire those events.
On Oct 5, 2012, at 9:56 AM, David Heinemeier Hansson [email protected] wrote:
How is the datepicker currently initialized? Using jQuery.ready?
—
Reply to this email directly or view it on GitHub.
from turbolinks-classic.
The jQuery datepicker initializes on the first call to $.fn.datepicker, and then sets a global variable to true
.
https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js#L1816-1820
@davydotcom's solution will bind the mousedown event with every page load, which is terrible.
You just need to append the element to the document again:
jQuery.datepicker.dpDiv.appendTo( jQuery('body') );
... or open tickets with jQuery UI (and everybody else in the world) to jump hoops to decide if their widgets have been blown away or not :P
from turbolinks-classic.
Ah, thanks
On Oct 18, 2012, at 10:52 PM, Ryan Florence [email protected] wrote:
... or open tickets with jQuery UI (and everybody else in the world) to jump hoops to decide if their widgets have been blown away or not :P
from turbolinks-classic.
Actually there is already a ticket and pull request for the date picker to fix this bug anyway. The bug is the fact that if the dpDiv does not exist in the body, to readd it.
This affects more than just turbolinks, it apparently affects some other edge cases as well.
On Oct 19, 2012, at 8:05 AM, [email protected] wrote:
Ah, thanks
On Oct 18, 2012, at 10:52 PM, Ryan Florence [email protected] wrote:
... or open tickets with jQuery UI (and everybody else in the world) to jump hoops to decide if their widgets have been blown away or not :P
from turbolinks-classic.
@davydotcom, nice, they have a pull request open too:
Bug tracker
http://bugs.jqueryui.com/ticket/5679
pull request
from turbolinks-classic.
I know that this ticket is closed but I solved this problem in different way:
$(document).on 'page:change', ->
$.datepicker.initialized = false
It works like a charm.
from turbolinks-classic.
This was originally mentioned in the issue, however it causes the date
picker to add multiple event listeners
On Wednesday, December 19, 2012, Rafal wrote:
I know that this ticket is closed but I solved this problem in different
way:$(document).on 'page:change', ->
$.datepicker.initialized = falseIt works like a charm.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-11527748.
from turbolinks-classic.
Related Issues (20)
- Page does not always scroll to the top when DOM loads too fast
- SVG anchors not working with turbolinks
- Turbolinks.visit, partial replacement & relative urls (& IE11)
- Not correctly inferring protocol with SSL, unless force_ssl is set HOT 2
- Redirect and reload full page HOT 1
- JavaScript part of turbolinks on npm HOT 11
- Enable Turbolinks on a-tags after adding content over AJAX HOT 1
- File type blacklist instead of whitelist
- Scroll position of data-turbolinks-permanent elements lost on navigation. HOT 3
- Webpage without title, after turbolink has title of undefined HOT 1
- Problems with JS HOT 1
- Rails 5 deprecations
- Would you please tell me how to add your library or whether it's necessary to add this library?
- Sorry for duplicate
- Progress bar causing capybara tests to fail
- Documentation does not explain how to install current turbolinks-classic version HOT 1
- temporary inside permanent
- Clicking browser back button from an error page to a non-error page, retains the styles of the error page
- Turbolinks.enableProgressBar() returns undefined
- How to binding "page:load" cache-preview
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbolinks-classic.