hntw / scaljs

Automatically exported from code.google.com/p/scaljs
0 stars 0 forks source link

Default selected date will be 'stuck' when a new date is selected #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
My init code:

' --------------------------------------------------
var options = Object.extend({
            titleformat: 'mmmm yyyy',
            closebutton: 'X',
            month: 8,
            year: 2011,
            day: 26,
            dayheadlength: 2,
            weekdaystart: 0,
            planner: true
        }, arguments[0] || {});
        samplecal = new scal('cal', function(d) {
            alert(d.format('mmmm dd, yyyy'));
        }, options);
' --------------------------------------------------

The calender works great except when i pass in a day, month, and year. The 
correct date is selected by default but does not deselect when a new date is 
picked. The result is two dates being selected which is not desirable.

I've found that the cause of this is that this.selectedElement object is set to 
false by default and not set to the default selected element.

Adding the following line to the bottom of the initialize function in the scal 
class fixes this issue:
' --------------------------------------------------
this.selectedElement = this.element.select('.dayselected')[0] ? 
this.element.select('.dayselected')[0] : false;
' --------------------------------------------------

Scott Wagoner
r168 - windows 7 - Google Chrome

Original issue reported on code.google.com by CounterS...@gmail.com on 27 Aug 2011 at 12:25

Attachments: