首页 > 代码库 > extjs的日期时间空间datetimefiled

extjs的日期时间空间datetimefiled

/**
 * 此控件支持Ext3.2及以上版本
 * 用法与Ext.form.DateField一样
 * 例如:var startDt = new Ext.ux.DateTimeField({fieldLabel:‘开始时间‘,name:‘startTm‘});
 */
Ext.ux.DateTimeField = Ext.extend(Ext.form.DateField, {
	width:145,
	format:‘Y-m-d H:i:s‘,
	onTriggerClick : function(){
        if(this.disabled){
            return;
        }
        if(this.menu == null){
            this.menu = new Ext.ux.DateTimeMenu({
                hideOnClick: false,
                focusOnSelect: false
            });
        }
        this.onFocus();
        Ext.apply(this.menu.picker,  {
            minDate : this.minValue,
            maxDate : this.maxValue,
            disabledDatesRE : this.disabledDatesRE,
            disabledDatesText : this.disabledDatesText,
            disabledDays : this.disabledDays,
            disabledDaysText : this.disabledDaysText,
            format : this.format,
            showToday : this.showToday,
            minText : String.format(this.minText, this.formatDate(this.minValue)),
            maxText : String.format(this.maxText, this.formatDate(this.maxValue))
        });
        this.menu.picker.setValue(this.getValue() || new Date());
        this.menu.show(this.el, "tl-bl?");
        this.menuEvents(‘on‘);
    },
    getErrors: function(value) {
        var errors = Ext.form.DateField.superclass.getErrors.apply(this, arguments);

        value = http://www.mamicode.com/this.formatDate(value || this.processValue(this.getRawValue()));"227px";
    	}
    }
});

Ext.ux.DateTimePicker = Ext.extend(Ext.DatePicker, {
	setValue : function(value){
        this.value = http://www.mamicode.com/value;"SELECT");
				this.minuteEl = document.createElement("SELECT");
				this.secondEl = document.createElement("SELECT");
				
				this.hourEl.style.visibility="visible";
				this.minuteEl.style.visibility="visible";
				this.secondEl.style.visibility="visible";

        this.value = http://www.mamicode.com/this.value ? this.value : new Date();"7";
		td.align="center";
		var hmTb = document.createElement(‘table‘);
		var hmBody = document.createElement(‘tbody‘);
		var hmTr = document.createElement(‘tr‘);
		
		var hmHoursTd = document.createElement(‘td‘);
		hmHoursTd.className = "x-date-hour";
		
		hmHoursTd.appendChild(this.hourEl);
		for(var i=0;i<24;i++){
			var houroption = document.createElement("OPTION");
			houroption.value=http://www.mamicode.com/i;":"));
		hmTr.appendChild(hmSepTd);
		
		var hmMinuteTd = document.createElement(‘td‘);
		hmMinuteTd.className = "x-date-minute";
		hmMinuteTd.appendChild(this.minuteEl);
		for(var i=0;i<60;i++){
			var minuteOption = document.createElement("OPTION");
			minuteOption.value=http://www.mamicode.com/i;":"));
		hmTr.appendChild(hmSepTd);
		
		var hmSecondTd = document.createElement(‘td‘);
		hmSecondTd.className = "x-date-second";
		hmSecondTd.appendChild(this.secondEl);
		for(var i=0;i<60;i++){
			var minuteOption = document.createElement("OPTION");
			minuteOption.value=http://www.mamicode.com/i;> 


网上找的,怕以后用就存下来,在extjs3中可以用,还有少许问题,但不影响使用

var datetime1 = new Ext.ux.DateTimeField({
id : ‘start_time_field‘,
name : ‘startTime‘,
xtype : ‘datetimefield‘,
// format : ‘Y-m-d‘,
width : 150,
editable : true
});

extjs的日期时间空间datetimefiled