mootools date picker

http://www.monkeyphysics.com/mootools/script/2/

用intialize方法重新加载picker对象,类似reload refresh 方法,Mu

//datepicker
            calendar2 = null;
            var loadCalendar2 = function(){
               
                if($(‘date_depart’).value)
                {
                    currentmindate = new Date($(‘date_depart’).value);
                }
                if(!calendar2)
                {
                    calendar2 = new DatePicker(‘.date_retour’, {
                        days : trans_days,
                        months : trans_months,
                        minDate: currentmindate,
                        maxDate: currentmaxdate,
                        inputOutputFormat: ‘Y/m/d H:i:s’,
                        onSelect: function(date) {
                            //calendar1.options.maxDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
                            /* if ( $(‘research_button_etape_1’) == undefined )
                                this.callAjaxReservation(); */
                            if ( date.getDay() == 6 && !this.showWarningSaturday )
                            {
                                //this.showWarningSaturday = true;
                                this.showPopUp(‘/index.php?template=reservation/popup_warning_saturday’, ‘ajax’, 460, 360);
                            }
                        }.bind(this),
                        pickerClass: ‘datepicker_vista’,
                        allowEmpty: true,
                        toggleElements: ‘.showCalendar2’
                    });
                }
                else{
                    // change mindate of date_retour
                    $$(‘.date_retour’).set(‘value’, ”);
                    calendar2.initialize(‘.date_retour’, {minDate: currentmindate});
                }
            }
           
            calendar1 = new DatePicker(‘.date_depart’, {
                days : trans_days,
                months : trans_months,
                minDate: currentmindate,
                maxDate: currentmaxdate,
                inputOutputFormat: ‘Y/m/d H:i:s’,
                onSelect: function(date) {
                    //calendar2.options.minDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
                    /* if ( $(‘research_button_etape_1’) == undefined )
                        this.callAjaxReservation(); */
                    if ( date.getDay() == 6 && !this.showWarningSaturday )
                    {
                        //this.showWarningSaturday = true;
                        this.showPopUp(‘/index.php?template=reservation/popup_warning_saturday’, ‘ajax’, 460, 360);
                    }
                   
                    // load Calendar2
                    loadCalendar2();
                }.bind(this),
                pickerClass: ‘datepicker_vista’,
                allowEmpty: true,
                toggleElements: ‘.showCalendar’
            });
            // first load calendar2
            loadCalendar2();

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s