X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Roo%2Fbootstrap%2FDateField.js;h=ba18ac35df1a2cd51b50adc28d6104dad331e8f4;hb=9be6e45a0ff049e97ab69d97706b81d8a0500fb1;hp=1688e9919a399e1adfef054800ad5658345a92db;hpb=cfb0947214870c655e7e11ac72c1a1a3b551927b;p=roojs1 diff --git a/Roo/bootstrap/DateField.js b/Roo/bootstrap/DateField.js index 1688e9919a..ba18ac35df 100644 --- a/Roo/bootstrap/DateField.js +++ b/Roo/bootstrap/DateField.js @@ -227,7 +227,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { this.showMode(); if(this.isInline) { - this.showpopup(); + this.showPopup(); } }, @@ -510,7 +510,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { onFocus : function() { Roo.bootstrap.DateField.superclass.onFocus.call(this); - this.show(); + this.showPopup(); }, onBlur : function() @@ -521,7 +521,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { this.setValue(d); - this.hide(); + this.hidePopup(); }, showPopup : function() @@ -590,7 +590,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { { if (!this.picker().isVisible()){ if (e.keyCode == 27) { // allow escape to hide and re-show picker - this.show(); + this.showPopup(); } return; } @@ -601,7 +601,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { switch(e.keyCode){ case 27: // escape - this.hide(); + this.hidePopup(); e.preventDefault(); break; case 37: // left @@ -661,19 +661,19 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { break; case 13: // enter this.setValue(this.formatDate(this.date)); - this.hide(); + this.hidePopup(); e.preventDefault(); break; case 9: // tab this.setValue(this.formatDate(this.date)); - this.hide(); + this.hidePopup(); break; case 16: // shift case 17: // ctrl case 18: // alt break; default : - this.hide(); + this.hidePopup(); } }, @@ -721,13 +721,16 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { // this.fill() this.setValue(this.formatDate(this.date)); - this.hide(); + this.hidePopup(); break; } break; case 'span': if (className.indexOf('disabled') < 0) { - this.viewDate.setUTCDate(1); + if (!this.viewDate) { + this.viewDate = new Date(); + } + this.viewDate.setUTCDate(1); if (className.indexOf('month') > -1) { this.viewDate.setUTCMonth(Roo.bootstrap.DateField.dates[this.language].monthsShort.indexOf(html)); } else { @@ -738,7 +741,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { if(this.singleMode){ this.setValue(this.formatDate(this.viewDate)); - this.hide(); + this.hidePopup(); return; } @@ -751,8 +754,8 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { //Roo.log(className); if (className.indexOf('day') > -1 && className.indexOf('disabled') < 0 ){ var day = parseInt(html, 10) || 1; - var year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(); + var year = (this.viewDate || new Date()).getUTCFullYear(), + month = (this.viewDate || new Date()).getUTCMonth(); if (className.indexOf('old') > -1) { if(month === 0 ){ @@ -775,7 +778,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input, { // this.fill(); //Roo.log(this.formatDate(this.date)); this.setValue(this.formatDate(this.date)); - this.hide(); + this.hidePopup(); } break; } @@ -1083,7 +1086,7 @@ Roo.apply(Roo.bootstrap.DateField, { template : { tag: 'div', - cls: 'datepicker dropdown-menu roo-dynamic', + cls: 'datepicker dropdown-menu roo-dynamic shadow', cn: [ { tag: 'div',