-
Notifications
You must be signed in to change notification settings - Fork 156
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
Calendar "jumps" on select if multiple months are displayed #16
Comments
same problem! |
I do not believe this is an issue but actual functionality. It appears to be moving the month with the currently selected date to the front of the view. There should be an option to disable this movement. |
Hi everybody. I think that I have found a solution. So far it has worked for me. I have tried to do it in a correct way. Just on top of the else clausure, there are two similar lines, where the min and maxDate are stablished. I think that is needed to the same with those two. But I have not done yet, because I did not need so far. If you have any problem post it, I will be watching this post. |
I've done some testing and found a solution to the problem. ddelella was correct in that it is functioning as directed. In order to prevent the month jumping, simply remove the |
I don't think that this issue is closed. If you go to your demo page http://multidatespickr.sourceforge.net/ and edit the full year example to be: var today = new Date();
var y = today.getFullYear();
$('#full-year').multiDatesPicker({
addDates: ['10/14/'+y, '02/19/'+y, '01/14/'+y, '11/16/'+y],
numberOfMonths: [3,4]
}); it still jumps to bring the month you just clicked in to the first element. |
I'm going to have to check with Luca to see what code he's using on that page, because I put together a similar test with just the minimum code required and it didn't jump at all. <link redacted> Only line in the body is <div id='datepickerInput'></div> And in the head, to call the datepicker: $(function() {
var today = new Date();
var y = today.getFullYear();
$('#datepickerInput').multiDatesPicker({
addDates: ['10/14/'+y, '02/19/'+y, '01/14/'+y, '11/16/'+y],
numberOfMonths: [3,4]
});
}); I even used a link to the same exact MDP code he's using. So I think the error is on the site. Thanks for pointing this out, I'll figure out why it doesn't work on the demo. |
Even in this example, the calendar jumps. Calvin On Tue, Sep 4, 2012 at 12:18 PM, aqisnotliquid [email protected]:
|
It is now. I'm making active changes to it to figure out what's different. |
Setting the MaxDate +1Y fixes the problem if you only want to have 1 year, see http://stackoverflow.com/questions/10198379/jqueryui-datepicker-12-months-view-jumps-when-clicked-on-date. It does not help if you want to display 12 months but also allow the user to scroll to 2nd year etc. |
I followed antugc's suggestion... simply removed the offending lines of code from the plugin. No more jumping. |
Just remove the else in line 108 aka (else { |
The above method from GRogkakos works. |
Yes, this works but: |
I've hit the same problem where I need to show a whole year starting from January of the current year but able to navigate to next/previous years and the months jump around when a date is selected. The only solution I found to this was to remove 'showCurrentAtPos: today.getMonth()' and instead do: var today = new Date(); $element.multiDatesPicker(options); This sets the current month to January and the current month is shown in the first position by default, since the setDate command is on the underlying datepicker and not the multiDatesPicker the date isn't actually shown as selected or included in the multiDatesPicker list of selected dates. |
Sorry, actually this multiple months problem affected many and actually was not a bug of MDP nor jQuery Datepicker... it was my example that used the wrong option! |
I've a problem about multiDatesPicker... |
Below option resolved jumping issue when multiple dates selected across different months var tempSelectedDate = ''; beforeShow: function(input, inst) { |
Here a demostration of the effects of the option I'll test if removing the refresh mentioned by @michaelc4 suggests doesn't break the funcionality, so to avoid unneeded code execution. What I know is that it doesn't solve the jumping problem (already tested). |
Hi, $host.find('#availability_calendar').multiDatesPicker({ And when I select a date in a month other then the first, calendar jump to display month of the selected date at position 0. How could I avoid this? With what I read hear I should not have this problem as I haven't specify showCurrentAtPos. I'm using multi-dates-picker-rails that package this code thanks |
If the
numberOfMonths
value is set to greater than 1, anytime you select a date in a month other than the first month, the calendar moves the month that you just selected to become the first month, causing a "jump".For example, I've set
numberOfMonths = 2
and the calendar currently displays Jan and Feb. If I pick a date in Jan, there is no problem. But if I pick a date in Feb, the calendar refreshes and now displays Feb and Mar.It may have something to do with the
showCurrentAtPos
option, but the issue only seems to happen with MDP and not with the standard datepicker.The text was updated successfully, but these errors were encountered: