Skip to main content

Search and Top Navigation

#9494 closed bug (notabug)

Opened August 12, 2013 08:28PM UTC

Closed August 16, 2013 12:50PM UTC

Last modified August 16, 2013 01:06PM UTC

inst.drawMonth & inst.drawYear can't set on beforeShow

Reported by: ZardoZAntony Owned by: ZardoZAntony
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

need fix.

fix example:

#!js
_showDatepicker {
...
inst.drawMonth = inst.drawYear = -1;  
beforeShow = $.datepicker._get(inst, "beforeShow");
..
}
 _setDateFromField{
...
  if (inst.drawMonth == -1)     
      inst.drawMonth = inst.selectedMonth = date.getMonth();
  else 
       inst.selectedMonth = inst.drawMonth;

  if (inst.drawYear == -1)     
      inst.drawYear = inst.selectedYear = date.getFullYear();
  else
      inst.selectedYear = date.getFullYear();

//inst.drawMonth = inst.selectedMonth = date.getMonth();
//inst.drawYear = inst.selectedYear = date.getFullYear();

}

Attachments (0)
Change History (8)

Changed August 12, 2013 08:35PM UTC by tj.vantoll comment:1

owner: → ZardoZAntony
status: newpending

Hi ZardoZAntony,

Thanks for taking the time to contribute to the jQuery UI project. Can you please provide a test case that shows the problem that you are experiencing? You can use this as a starting point - http://jsfiddle.net/tj_vantoll/tRdpr/.

Changed August 13, 2013 07:08AM UTC by ZardoZAntony comment:2

status: pendingnew

Changed August 13, 2013 12:46PM UTC by scottgonzalez comment:3

status: newpending

What made you think you were allowed to set those?

Changed August 15, 2013 03:31AM UTC by ZardoZAntony comment:4

status: pendingnew

Why not?

And how i can set first draw month some other way?

I show 3 months. The current date is in the middle.

Changed August 16, 2013 12:50PM UTC by tj.vantoll comment:5

resolution: → notabug
status: newclosed

The documentation makes it seem like this should be possible, but

beforeShow
is a bizarre API so I'm not sure there's much we could do to clarify that it isn't. After the widget factory rewrite there will be an open event that can be used as a hook to set options.

Replying to [comment:4 ZardoZAntony]:

Why not? And how i can set first draw month some other way? I show 3 months. The current date is in the middle.

This seems like a reasonable feature request. Feel free to open another ticket for that and we might make that possible as part of the rewrite. Here's a hack-tastic way of accomplishing it http://jsfiddle.net/tj_vantoll/wmm2n/.

Changed August 16, 2013 12:56PM UTC by scottgonzalez comment:6

I don't see what makes it seem like this should be possible. Properties directly on the instance are private, they're never mention anywhere in the docs. It sounds like you're looking for the showCurrentAtPos option.

Changed August 16, 2013 01:01PM UTC by tj.vantoll comment:7

Replying to [comment:6 scott.gonzalez]:

I don't see what makes it seem like this should be possible. Properties directly on the instance are private, they're never mention anywhere in the docs. It sounds like you're looking for the showCurrentAtPos option.

Since

drawMonth
and other properties are on the object passed to
beforeShow
I could see thinking that you could set any of them. Datepicker has enough options that it's hard to know what's internal and what isn't. I clearly forgot about
showCurrentAtPos
for instance :P

Changed August 16, 2013 01:06PM UTC by scottgonzalez comment:8

I forget that the instance is passed around in datepicker :-/ The rewrite can't come soon enough.