Add ability to move selector boxes (month/year) to any displayed month
in Developing jQuery UI
•
5 years ago
Current situation: The selector boxes for month/year appear on the first
month displayed in a multi-month layout, however if you have the active
month set other than the first position, the selection of months is
non-intuitive. The month you select in the selectors is not the month
that then appears below the selectors, leading to user confusion when
selecting dates.
Example: with option showCurrentAtPos = 1
Example: with option showCurrentAtPos = 1
- [October] ------------ [November] ----------- [December]
- ^ Selector here ^ Chosen month ^ Following month
Proposed is an additional option (and this would still be valid for the rewrite) showSelectorAtPos, which allows for the selector to be moved to any of the valid positions, and would take the month/year details from the position it was in. In the case where showCurrentAtPos = 1 and showSelectorAtPos = 1, you would have
- [October] ------------ [November] -------------------------- [December]
- ^Previous month ^ Chosen month & selector ^ Following month
This can be implemented in the current branch (pull request already rejected though due to upcoming changes) with the following (diff against the full current .zip version of datepicker.js):
- diff jquery-ui.js jquery-ui.new.js
- 3885c3885,3886
- < showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
- ---
- > showCurrentAtPos: 0, // The position in multiple months at which to show the current month (starting at 0)
- > showSelectorAtPos: 0, // The position in multiple months to show the selector
- 5464a5466,5467
- > showSelectorAtPos = this._get(inst, "showSelectorAtPos");
- > if (showSelectorAtPos<0 || showSelectorAtPos>=( ( ( numMonths[ 0 ] - 1 ) * numMonths[ 1 ] ) + numMonths[ 1 ] ) ) {
- showSelectorAtPos=0;
-
}
5492c5495 - <
row > 0 || col > 0, monthNames, monthNamesShort) + // draw
month headers
--- - > (row * numMonths[ 1 ] + col ) !== showSelectorAtPos, monthNames, monthNamesShort) + // draw month headers
Closed/rejected pull request 1668 demonstrates the proposal.
(Note: Could not get Trac to play nicely enough to allow me to
register, login or post this as an issue for discussion there - errors
on every page).
1