如题:
我需要一个扩展的datefield 控件, 可以输入 至今 文字在输入框内!
想要的效果如下图:
[img]http://dl.iteye.com/upload/attachment/294226/4bf9bf54-e687-3dc9-b64d-a512b029a504.png[/img]
如题:
我需要一个扩展的datefield 控件, 可以输入 至今 文字在输入框内!
想要的效果如下图:
[img]http://dl.iteye.com/upload/attachment/294226/4bf9bf54-e687-3dc9-b64d-a512b029a504.png[/img]
兄弟,我再给你找一点,这个Today是在DatePicker.js里修改
[code="js"]
todayText : 'Today',//这里改成“至今”
//创建Today按钮的地方。
this.todayBtn = new Ext.Button({
renderTo: this.el.child('td.x-date-bottom', true),
text: String.format(this.todayText, today),
tooltip: String.format(this.todayTip, today),
handler: this.selectToday,
scope: this
}
[/code]
看到了吗?那个handler绑定的就是点击的函数。这里是selectToday。
[code="js"]
selectToday : function(){
if(this.todayBtn && !this.todayBtn.disabled){
this.setValue(new Date().clearTime());
this.fireEvent('select', this, this.value);
}
}
[/code]
看到这个函数力的 this.setValue(new Date().clearTime());设置今天的值。
你这里 this.setValue("至今");就好了。