Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#9679 closed enhancement (fixed)

[patch] [cla] Allow Calendar to select multiple dates

Reported by: Jean-Rubin Leonard Owned by: Adam Peller
Priority: high Milestone: 1.7
Component: DojoX Widgets Version: 1.3.2
Keywords: multiple date calendar dateTextBox Cc: David Schwartz, Douglas Hays
Blocked By: Blocking:

Description (last modified by Adam Peller)

Currently the datepicker allows to select only one date and it returns the data to the underlying text box. A functionality that is missing and that is very useful is the ability to select multiple dates. I agree this should probably not be a text box as the result of selecting multiple dates should probably be an array or a JSON hash. This should probably be a new dijit or control. The functionality is present in jquery or yahoo library. It would be awesome to have it in Dojo as well. Possible features:

  • give user the option to specify dates that should start selected (based on day of week, week-end, weekdays)
  • give user the option to specify the end and start date of the calendar

Attachments (13)

calendarClaro.diff (417 bytes) - added by Jean-Rubin Leonard 9 years ago.
calendarNihilo.diff (391 bytes) - added by Jean-Rubin Leonard 9 years ago.
calendarSoria.diff (390 bytes) - added by Jean-Rubin Leonard 9 years ago.
calendarTundra.diff (391 bytes) - added by Jean-Rubin Leonard 9 years ago.
dojoxMods.diff (22.8 KB) - added by Jean-Rubin Leonard 9 years ago.
newCalendar.diff (26.9 KB) - added by Jean-Rubin Leonard 9 years ago.
testMultiSelectCalendar.html (989 bytes) - added by Jean-Rubin Leonard 9 years ago.
calendar2.diff (27.0 KB) - added by Jean-Rubin Leonard 9 years ago.
mSC.2.diff (33.8 KB) - added by Jean-Rubin Leonard 9 years ago.
multiselectCalendar.html (857 bytes) - added by Jean-Rubin Leonard 9 years ago.
Test File
msc.diff (38.8 KB) - added by Jean-Rubin Leonard 9 years ago.
msc2.diff (879 bytes) - added by Jean-Rubin Leonard 9 years ago.
msc2.2.diff (758 bytes) - added by Jean-Rubin Leonard 9 years ago.

Download all attachments as: .zip

Change History (47)

comment:1 Changed 10 years ago by Jean-Rubin Leonard

This is an example of multi-select functionality: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiple.html

The Example of 3 calendars put side by side on this page http://www.eyecon.ro/datepicker/ is also something neat that could be implemented.

comment:2 Changed 10 years ago by Adam Peller

Milestone: 1.4tbd

See #9317

comment:3 Changed 10 years ago by Adam Peller

Milestone: tbd1.5

comment:4 Changed 10 years ago by Jean-Rubin Leonard

Is this still on track for 1.5? Just checking as there hasn't been any updates in a while.

comment:5 Changed 10 years ago by Adam Peller

no promises, I'm afraid. If anyone is free to work on this or has patches, it would be great to have. I will try to work on it before the 1.5 release.

comment:6 Changed 10 years ago by Adam Peller

Milestone: 1.51.6

comment:7 Changed 10 years ago by Adam Peller

Summary: Allow dateTextBox to select multiple datesAllow Calendar to select multiple dates

Several different things here... multiple selection might be easiest to achieve on the Calendar widget itself. How to represent this in a textbox is a separate problem and part of that depends on whether we're talking about contiguous ranges or individual dates. Side-by-side calendars: see #7985 Not sure whether this would all come together in a super configurable DateTextBox? type of widget or specialized widgets.

comment:8 Changed 9 years ago by Adam Peller

Cc: David Schwartz Douglas Hays added

comment:9 Changed 9 years ago by Adam Peller

Description: modified (diff)

Changed 9 years ago by Jean-Rubin Leonard

Attachment: calendarClaro.diff added

Changed 9 years ago by Jean-Rubin Leonard

Attachment: calendarNihilo.diff added

Changed 9 years ago by Jean-Rubin Leonard

Attachment: calendarSoria.diff added

Changed 9 years ago by Jean-Rubin Leonard

Attachment: calendarTundra.diff added

Changed 9 years ago by Jean-Rubin Leonard

Attachment: dojoxMods.diff added

comment:10 Changed 9 years ago by Jean-Rubin Leonard

Modifications brought to dojoxMods.diff. This patch can now be enabled.

Changed 9 years ago by Jean-Rubin Leonard

Attachment: newCalendar.diff added

comment:11 Changed 9 years ago by Jean-Rubin Leonard

all the other attachments can be ignored except for newCalendar.diff, which contains the new code for the multiSelectCalendar, the multiSelectCalendarButton and the multiSelectCalendar.css file.

Changed 9 years ago by Jean-Rubin Leonard

comment:12 Changed 9 years ago by Adam Peller

Minor housekeeping: patch file should have the paths worked out relative to the dojo base (test file has "js/", css file is in the js dir and is not capitalized, etc.) Did we decide to make the button part of the test for now and not a public JS module?

Changed 9 years ago by Jean-Rubin Leonard

Attachment: calendar2.diff added

comment:13 Changed 9 years ago by Jean-Rubin Leonard

Corrected parseInt bug. The radix was missing. Replaced ParseInt? with Number.

comment:14 Changed 9 years ago by Adam Peller

Component: DateDijit
Owner: Adam Peller deleted

comment:15 Changed 9 years ago by bill

Component: DijitDojoX Widgets
Owner: set to dante
Summary: Allow Calendar to select multiple dates[patch] [cla] Allow Calendar to select multiple dates

I agree this would be useful for some apps but I don't think a common enough control for dijit. The patch file is actually for dojox.widget and I agree it should go there (if anywhere).

comment:16 Changed 9 years ago by Adam Peller

Owner: changed from dante to Adam Peller

comment:17 Changed 9 years ago by nedosa@…

I think this feature is quite significant to bring the calendar's functionality an par with other js frameworks. Is it targeted for calendar multiselect to land on 1.6 ? Regards.

comment:18 Changed 9 years ago by Jean-Rubin Leonard

My work was submitted but I think rejected. Maybe if you Plus one (+1) it might make a difference. JR

comment:19 Changed 9 years ago by nedosa@…

+1

comment:20 in reply to:  18 Changed 9 years ago by nedosa@…

Replying to simpli:

My work was submitted but I think rejected. Maybe if you Plus one (+1) it might make a difference. JR

Do you patch is compatible with the 1.6 release and if not, would it be a lot of work to bring it forward ?

comment:21 Changed 9 years ago by Jean-Rubin Leonard

I haven't updated to 1.6 yet so I couldn't tell. I'm not sure of the extent of stuff that changed in 1.6 either. I can't answer at the moment. JR

comment:22 Changed 9 years ago by Adam Peller

@simpli, sorry I've neglected this one. Is there a single unified diff? If not, which patches am I supposed to use again?

comment:23 Changed 9 years ago by Adam Peller

I applied calendar2.diff and also the test, which should be placed at dojox/widget/tests. The patch does not run against trunk. Unfortunately, there were significant changes to dijit.Calendar which need to be merged. For future releases, we should see if there's a way dijit.Calendar could be restructured to make call outs so we don't have to duplicate so much code.

comment:24 Changed 9 years ago by Jean-Rubin Leonard

I think it was meant to be a new widget altogether that extended calendar. I'll be hanging around #dojo in the next few days to see how I can help.

comment:25 Changed 9 years ago by Adam Peller

Milestone: 1.61.7

Changed 9 years ago by Jean-Rubin Leonard

Attachment: mSC.2.diff added

Changed 9 years ago by Jean-Rubin Leonard

Attachment: multiselectCalendar.html added

Test File

comment:26 Changed 9 years ago by Jean-Rubin Leonard

Submmited modified source file with some editing as well as a test file as per wildbill request. JR

comment:27 Changed 9 years ago by Adam Peller

The test file needs to have paths that match up against the directory structure. Some simple instructions to test might be useful in the absence of automated tests. You might try copying one of the files from dojox/widget. patch files are best to show file location.

We're still sharing dijit templates, but we've forked from dijit logic. Perhaps this is the most pragmatic thing to do, but it's still fragile. If we're going to fork, should we fork both? What does wildbill think?

A couple minor things:

  • should declare dojo.experimental
  • many values can be moved out of the prototype into the object instance, especially if they're not intended to be 'public API' (e.g. currentMonth) and the null initializers are unnecessary in any event.
  • bedlumped named "_" should be used for new methods which are not intended to be public API.
  • avoid using dojo.date.format for non-i18n related calculations when simple string concat will be much faster
  • can remove deprecated setValue

Changed 9 years ago by Jean-Rubin Leonard

Attachment: msc.diff added

comment:28 Changed 9 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [24741]) MultiSelectCalendar? from Jean-Rubin Leonard. Forked dijit.Calendar code, for now. Experimental. Fixes #9679 \!strict

comment:29 Changed 9 years ago by Adam Peller

A couple of observations - the dropdownmenu code was called "dijit.Calendar..." in the patch and would have collided with the dijit.Calendar code, so I renamed it. The "T00:00:00" passed to Date constructors assumes ES5 which is not available in all browsers. For just those two lines of code, you may wish to use the old Date API.

comment:30 Changed 9 years ago by Adam Peller

Select May 9. Then, select the range May 1-May20. May 9 gets deselected in the middle of the range. I would have expected it to stay selected as part of the new range. Bug or intentional behavior? Also, shift+arrow might be good to support as the equivalent of shift-click.

comment:31 Changed 9 years ago by Jean-Rubin Leonard

The behavior is intentional. When we select a range everything in that range is toggled. If the date was already selected it will remove it from the selection. JR As for the dijit.Calendar, that was a mistake. Thanks for having corrected it.

Changed 9 years ago by Jean-Rubin Leonard

Attachment: msc2.diff added

comment:32 Changed 9 years ago by Jean-Rubin Leonard

patch to revert to old date API to avoid issue due to the lack of support of ES5 in some browsers.

comment:33 Changed 9 years ago by Adam Peller

if selectedDates[0] is a String of the form yyyy-MM-dd and you wish to convert it to a Date object, just call dojo.date.stamp.fromISOString()

Changed 9 years ago by Jean-Rubin Leonard

Attachment: msc2.2.diff added

comment:34 Changed 9 years ago by Adam Peller

(In [24821]) avoid ES5 Date constructor. Refs #9679 \!strict

Note: See TracTickets for help on using tickets.