Login Register

Setting a range of dates to be "auto-selected" when the calendar loads from a DateTextBox focus

Can this be done in release 1.0?

I'm working on an employee labor scheduling application that requires week selections, not day selections.

When the page loads, that field would be prepopulated with the current (or queried) date range for the week, ex. "3/2/08 - 3/8/08". And when the user clicks in the field, the calendar should popup with that entire week selected.

Also, if the user clicks in the field, then clicks on the 10th of March in the calendar, it should close the popup and insert "3/9/08 - 3/15/08" into the field.

I've spent quite a bit of time searching for information regarding this, as well as going through the source code.

If it's not available now, will it be available in the 1.1 release? (I've checked that source code as well)

Or will I need to write custom js to do this?

Thanks in advance,

Andy

my thoughts on this

I'm thinking that I just need to build a custom widget to do all of this. I just don't know where to start.

I'm not a javascript heavy hitter (on scale of 1 to 10, probably 5), but I could be if I applied myself to it and had a little direction on what to do for this situation. I'm not afraid to try anything.

That being said, if creating a custom widget is the right idea, please let me know, or if anyone has another path that I can take, I'd love to hear about it.

Thanks in advance,

andy

there is no range function in Calendar

I can confirm that Calendar can't do this in 1.1. There are no immediate plans to add this functionality. It would require enhancement or extension of the dijit._Calendar class, or a custom widget. Each cell in the calendar template can have a style applied to it, so a custom widget might try iterating through a range and setting a style with a background color. Mouse event handler logic would have to determine how to modify the range, and a new API would probably be required to represent the selected range.

Thank you peller!

Thanks Peller, I really appreciate the response and for pointing me in the right direction. When I'm finished I'll post the resulting code in case anyone else has the same need.

Thanks again,

Andy