HTML form与ExtJS的DatePicker的整合

<form>内有一<table>,<table>的一个<td>是酱紫的:

<td width="13%" class="outerRightBorder">
<div class="x-form-field-wrap" style="width:92px;"> 
<input tabindex=8 type="text" id="weiTuoRiQi" name="weiTuoRiQi"
           class="x-form-text x-form-field" style="display:inline;width:75px;" maxlength="200;"
           dataType="Date" 
           format="Y-m-d" 
           require="false" 
           msg="委托日期格式不正确&#13;正确的格式为:年-月-日,如2009-01-01"/>
<span style="height:20px;">
<img οnclick="javascript:REMS.showDatePicker(document.getElementById('weiTuoRiQi'));" class="x-form-trigger x-form-date-trigger"/>
</span> 
</div>
</td>

 产生的效果是酱紫的:

 

 

 

而呼叫ExtJSDatePicker的代码是酱紫的:

var REMS = {
    //...

    /**
     * show ExtJS date picker (singleton)
     * code borrowed from ExtJS, with slight modification
     */
    ,showDatePicker: function(target) {
        if(this.dateMenu == null){
            this.dateMenu = new Ext.menu.DateMenu();
            Ext.apply(this.dateMenu.picker,  {
                disabledDatesRE : this.ddMatch,
                disabledDatesText : this.disabledDatesText,
                disabledDays : this.disabledDays,
                disabledDaysText : this.disabledDaysText,
                format : 'Y-m-d',
                showToday : this.showToday
            });
        }
        Ext.apply(this.dateMenu.picker, {format:target.getAttribute('format')});
        
        this.dateMenuListeners = {
            select: function(m, d){
                target.value = d.format(target.getAttribute('format'));
                target.focus();
            },
            show : function(){ // retain focus styling
                //this.onFocus();
            },
            hide : function(){
                //this.focus.defer(10, this);
                var ml = this.dateMenuListeners;
                this.dateMenu.un("select", ml.select,  this);
                this.dateMenu.un("show", ml.show,  this);
                this.dateMenu.un("hide", ml.hide,  this);
                target.focus();
            }
        };
        this.dateMenu.on(Ext.apply({}, this.dateMenuListeners, {
            scope:this
        }));
        this.dateMenu.picker.setValue(Date.parseDate(target.value, target.getAttribute('format')) || new Date());
        this.dateMenu.show(target);
    }

    //...

}
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值