Roo/bootstrap/MonthField.js
[roojs1] / Roo / bootstrap / MonthField.js
1 /*
2  * - LGPL
3  *
4  * MonthField
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.MonthField
10  * @extends Roo.bootstrap.Input
11  * Bootstrap MonthField class
12  * 
13  * @cfg {String} language default en
14  * 
15  * @constructor
16  * Create a new MonthField
17  * @param {Object} config The config object
18  */
19
20 Roo.bootstrap.MonthField = function(config){
21     Roo.bootstrap.MonthField.superclass.constructor.call(this, config);
22     
23     this.addEvents({
24         /**
25          * @event show
26          * Fires when this field show.
27          * @param {Roo.bootstrap.MonthField} this
28          * @param {Mixed} date The date value
29          */
30         show : true,
31         /**
32          * @event show
33          * Fires when this field hide.
34          * @param {Roo.bootstrap.MonthField} this
35          * @param {Mixed} date The date value
36          */
37         hide : true,
38         /**
39          * @event select
40          * Fires when select a date.
41          * @param {Roo.bootstrap.MonthField} this
42          * @param {Mixed} date The date value
43          */
44         select : true
45     });
46 };
47
48 Roo.extend(Roo.bootstrap.MonthField, Roo.bootstrap.Input,  {
49     
50     format : "F",
51     
52     onRender: function(ct, position)
53     {
54         
55         Roo.bootstrap.MonthField.superclass.onRender.call(this, ct, position);
56         
57         this.language = this.language || 'en';
58         this.language = this.language in Roo.bootstrap.MonthField.dates ? this.language : this.language.split('-')[0];
59         this.language = this.language in Roo.bootstrap.MonthField.dates ? this.language : "en";
60         
61         this.isRTL = Roo.bootstrap.MonthField.dates[this.language].rtl || false;
62         this.format = this.format || 'F';
63         this.isInline = false;
64         this.isInput = true;
65         this.component = this.el.select('.add-on', true).first() || false;
66         this.component = (this.component && this.component.length === 0) ? false : this.component;
67         this.hasInput = this.component && this.inputEL().length;
68         
69         this.minViewMode = 1;
70         this.viewMode = 1;
71                 
72         this.pickerEl = Roo.get(document.body).createChild(Roo.bootstrap.MonthField.template);
73         
74         this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
75         
76         this.picker().on('mousedown', this.onMousedown, this);
77         this.picker().on('click', this.onClick, this);
78         
79         this.picker().addClass('datepicker-dropdown');
80         
81         this.startViewMode = this.viewMode;
82
83         Roo.each(this.picker().select('tbody > tr > td', true).elements, function(v){
84             v.setStyle('width', '189px');
85         });
86         
87         this.fillDow();
88         this.fillMonths();
89         this.update();
90         this.showMode();
91         
92         if(this.isInline) {
93             this.show();
94         }
95     },
96     
97     setValue: function(v)
98     {
99         
100         var d = new Date(this.parseDate(v) ).clearTime();
101         
102         if(isNaN(d.getTime())){
103             this.date = this.viewDate = '';
104             Roo.bootstrap.DateField.superclass.setValue.call(this, '');
105             return;
106         }
107         
108         v = this.formatDate(d);
109         
110         Roo.bootstrap.DateField.superclass.setValue.call(this, v);
111         
112         this.date = new Date(d.getTime() - d.getTimezoneOffset()*60000);
113      
114         this.update();
115
116         this.fireEvent('select', this, this.date);
117         
118     },
119     
120     onClick: function(e) 
121     {
122         e.stopPropagation();
123         e.preventDefault();
124         
125         var target = e.getTarget();
126         
127         if(target.nodeName.toLowerCase() === 'i'){
128             target = Roo.get(target).dom.parentNode;
129         }
130         
131         var nodeName = target.nodeName;
132         var className = target.className;
133         var html = target.innerHTML;
134         
135         if(nodeName.toLowerCase() != 'span' || className.indexOf('disabled') > -1 || className.indexOf('month') == -1){
136             return;
137         }
138         this.viewDate.setUTCDate(1);
139         this.viewDate.setUTCMonth(Roo.bootstrap.DateField.dates[this.language].monthsShort.indexOf(html));
140         
141         this.setValue(this.formatDate(this.viewDate));
142         this.hide();
143                         
144     },
145     
146     picker : function()
147     {
148         return this.pickerEl;
149 //        return this.el.select('.datepicker', true).first();
150     },
151     
152     fillMonths: function()
153     {    
154         var i = 0
155         var months = this.picker().select('>.datepicker-months td', true).first();
156         
157         months.dom.innerHTML = '';
158         
159         while (i < 12) {
160             var month = {
161                 tag: 'span',
162                 cls: 'month',
163                 html: Roo.bootstrap.DateField.dates[this.language].monthsShort[i++]
164             }
165             
166             months.createChild(month);
167         }
168         
169     },
170     
171     update: function()
172     {
173         this.date = (typeof(this.date) === 'undefined' || ((typeof(this.date) === 'string') && !this.date.length)) ? this.UTCToday() : (typeof(this.date) === 'string') ? this.parseDate(this.date) : this.date;
174         
175         if (this.date < this.startDate) {
176             this.viewDate = new Date(this.startDate);
177         } else if (this.date > this.endDate) {
178             this.viewDate = new Date(this.endDate);
179         } else {
180             this.viewDate = new Date(this.date);
181         }
182         
183         this.fill();
184     },
185     
186     fill: function() 
187     {
188         var d = new Date(this.viewDate),
189                 year = d.getUTCFullYear(),
190                 month = d.getUTCMonth(),
191                 startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
192                 startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
193                 endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
194                 endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
195                 currentDate = this.date && this.date.valueOf(),
196                 today = this.UTCToday();
197         
198         this.picker().select('>.datepicker-days thead th.switch', true).first().dom.innerHTML = Roo.bootstrap.DateField.dates[this.language].months[month]+' '+year;
199         
200 //        this.picker().select('>tfoot th.today', true).first().dom.innerHTML = Roo.bootstrap.DateField.dates[this.language].today;
201         
202 //        this.picker.select('>tfoot th.today').
203 //                                              .text(dates[this.language].today)
204 //                                              .toggle(this.todayBtn !== false);
205     
206         this.updateNavArrows();
207         this.fillMonths();
208                                                 
209         var prevMonth = this.UTCDate(year, month-1, 28,0,0,0,0),
210         
211         day = prevMonth.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
212          
213         prevMonth.setUTCDate(day);
214         
215         prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
216         
217         var nextMonth = new Date(prevMonth);
218         
219         nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
220         
221         nextMonth = nextMonth.valueOf();
222         
223         var fillMonths = false;
224         
225         this.picker().select('>.datepicker-days tbody',true).first().dom.innerHTML = '';
226         
227         while(prevMonth.valueOf() < nextMonth) {
228             var clsName = '';
229             
230             if (prevMonth.getUTCDay() === this.weekStart) {
231                 if(fillMonths){
232                     this.picker().select('>.datepicker-days tbody',true).first().createChild(fillMonths);
233                 }
234                     
235                 fillMonths = {
236                     tag: 'tr',
237                     cn: []
238                 };
239                 
240                 if(this.calendarWeeks){
241                     // ISO 8601: First week contains first thursday.
242                     // ISO also states week starts on Monday, but we can be more abstract here.
243                     var
244                     // Start of current week: based on weekstart/current date
245                     ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
246                     // Thursday of this week
247                     th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
248                     // First Thursday of year, year from thursday
249                     yth = new Date(+(yth = this.UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
250                     // Calendar week: ms between thursdays, div ms per day, div 7 days
251                     calWeek =  (th - yth) / 864e5 / 7 + 1;
252                     
253                     fillMonths.cn.push({
254                         tag: 'td',
255                         cls: 'cw',
256                         html: calWeek
257                     });
258                 }
259             }
260             
261             if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
262                 clsName += ' old';
263             } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
264                 clsName += ' new';
265             }
266             if (this.todayHighlight &&
267                 prevMonth.getUTCFullYear() == today.getFullYear() &&
268                 prevMonth.getUTCMonth() == today.getMonth() &&
269                 prevMonth.getUTCDate() == today.getDate()) {
270                 clsName += ' today';
271             }
272             
273             if (currentDate && prevMonth.valueOf() === currentDate) {
274                 clsName += ' active';
275             }
276             
277             if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
278                     this.daysOfWeekDisabled.indexOf(prevMonth.getUTCDay()) !== -1) {
279                     clsName += ' disabled';
280             }
281             
282             fillMonths.cn.push({
283                 tag: 'td',
284                 cls: 'day ' + clsName,
285                 html: prevMonth.getDate()
286             })
287             
288             prevMonth.setDate(prevMonth.getDate()+1);
289         }
290           
291         var currentYear = this.date && this.date.getUTCFullYear();
292         var currentMonth = this.date && this.date.getUTCMonth();
293         
294         this.picker().select('>.datepicker-months th.switch',true).first().dom.innerHTML = year;
295         
296         Roo.each(this.picker().select('>.datepicker-months tbody span',true).elements, function(v,k){
297             v.removeClass('active');
298             
299             if(currentYear === year && k === currentMonth){
300                 v.addClass('active');
301             }
302             
303             if (year < startYear || year > endYear || (year == startYear && k < startMonth) || (year == endYear && k > endMonth)) {
304                 v.addClass('disabled');
305             }
306             
307         });
308         
309         
310         year = parseInt(year/10, 10) * 10;
311         
312         this.picker().select('>.datepicker-years th.switch', true).first().dom.innerHTML = year + '-' + (year + 9);
313         
314         this.picker().select('>.datepicker-years tbody td',true).first().dom.innerHTML = '';
315         
316         year -= 1;
317         for (var i = -1; i < 11; i++) {
318             this.picker().select('>.datepicker-years tbody td',true).first().createChild({
319                 tag: 'span',
320                 cls: 'year' + (i === -1 || i === 10 ? ' old' : '') + (currentYear === year ? ' active' : '') + (year < startYear || year > endYear ? ' disabled' : ''),
321                 html: year
322             })
323             
324             year += 1;
325         }
326     },
327     
328     showMode: function(dir) 
329     {
330         if (dir) {
331             this.viewMode = Math.max(this.minViewMode, Math.min(2, this.viewMode + dir));
332         }
333         
334         Roo.each(this.picker().select('>div',true).elements, function(v){
335             v.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
336             v.hide();
337         });
338         this.picker().select('>.datepicker-'+Roo.bootstrap.DateField.modes[this.viewMode].clsName, true).first().show();
339     },
340     
341     place: function()
342     {
343         if(this.isInline) return;
344         
345         this.picker().removeClass(['bottom', 'top']);
346         
347         if((Roo.lib.Dom.getViewHeight() + Roo.get(document.body).getScroll().top) - (this.inputEl().getBottom() + this.picker().getHeight()) < 0){
348             /*
349              * place to the top of element!
350              *
351              */
352             
353             this.picker().addClass('top');
354             this.picker().setTop(this.inputEl().getTop() - this.picker().getHeight()).setLeft(this.inputEl().getLeft());
355             
356             return;
357         }
358         
359         this.picker().addClass('bottom');
360         
361         this.picker().setTop(this.inputEl().getBottom()).setLeft(this.inputEl().getLeft());
362     },
363     
364     parseDate : function(value)
365     {
366         if(!value || value instanceof Date){
367             return value;
368         }
369         var v = Date.parseDate(value, this.format);
370         if (!v && (this.useIso || value.match(/^(\d{4})-0?(\d+)-0?(\d+)/))) {
371             v = Date.parseDate(value, 'Y-m-d');
372         }
373         if(!v && this.altFormats){
374             if(!this.altFormatsArray){
375                 this.altFormatsArray = this.altFormats.split("|");
376             }
377             for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
378                 v = Date.parseDate(value, this.altFormatsArray[i]);
379             }
380         }
381         return v;
382     },
383     
384     formatDate : function(date, fmt)
385     {   
386         return (!date || !(date instanceof Date)) ?
387         date : date.dateFormat(fmt || this.format);
388     },
389     
390     onFocus : function()
391     {
392         Roo.bootstrap.DateField.superclass.onFocus.call(this);
393         this.show();
394     },
395     
396     onBlur : function()
397     {
398         Roo.bootstrap.DateField.superclass.onBlur.call(this);
399         
400         var d = this.inputEl().getValue();
401         
402         this.setValue(d);
403                 
404         this.hide();
405     },
406     
407     show : function()
408     {
409         this.picker().show();
410         this.update();
411         this.place();
412         
413         this.fireEvent('show', this, this.date);
414     },
415     
416     hide : function()
417     {
418         if(this.isInline) return;
419         this.picker().hide();
420         this.viewMode = this.startViewMode;
421         this.showMode();
422         
423         this.fireEvent('hide', this, this.date);
424         
425     },
426     
427     onMousedown: function(e)
428     {
429         e.stopPropagation();
430         e.preventDefault();
431     },
432     
433     keyup: function(e)
434     {
435         Roo.bootstrap.DateField.superclass.keyup.call(this);
436         this.update();
437     },
438
439     getValue: function()
440     {
441         return this.formatDate(this.date);
442     },
443     
444     fireKey: function(e)
445     {
446         if (!this.picker().isVisible()){
447             if (e.keyCode == 27) // allow escape to hide and re-show picker
448                 this.show();
449             return;
450         }
451         
452         var dateChanged = false,
453         dir, day, month,
454         newDate, newViewDate;
455         
456         switch(e.keyCode){
457             case 27: // escape
458                 this.hide();
459                 e.preventDefault();
460                 break;
461             case 37: // left
462             case 39: // right
463                 if (!this.keyboardNavigation) break;
464                 dir = e.keyCode == 37 ? -1 : 1;
465                 
466                 if (e.ctrlKey){
467                     newDate = this.moveYear(this.date, dir);
468                     newViewDate = this.moveYear(this.viewDate, dir);
469                 } else if (e.shiftKey){
470                     newDate = this.moveMonth(this.date, dir);
471                     newViewDate = this.moveMonth(this.viewDate, dir);
472                 } else {
473                     newDate = new Date(this.date);
474                     newDate.setUTCDate(this.date.getUTCDate() + dir);
475                     newViewDate = new Date(this.viewDate);
476                     newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
477                 }
478                 if (this.dateWithinRange(newDate)){
479                     this.date = newDate;
480                     this.viewDate = newViewDate;
481                     this.setValue(this.formatDate(this.date));
482 //                    this.update();
483                     e.preventDefault();
484                     dateChanged = true;
485                 }
486                 break;
487             case 38: // up
488             case 40: // down
489                 if (!this.keyboardNavigation) break;
490                 dir = e.keyCode == 38 ? -1 : 1;
491                 if (e.ctrlKey){
492                     newDate = this.moveYear(this.date, dir);
493                     newViewDate = this.moveYear(this.viewDate, dir);
494                 } else if (e.shiftKey){
495                     newDate = this.moveMonth(this.date, dir);
496                     newViewDate = this.moveMonth(this.viewDate, dir);
497                 } else {
498                     newDate = new Date(this.date);
499                     newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
500                     newViewDate = new Date(this.viewDate);
501                     newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
502                 }
503                 if (this.dateWithinRange(newDate)){
504                     this.date = newDate;
505                     this.viewDate = newViewDate;
506                     this.setValue(this.formatDate(this.date));
507 //                    this.update();
508                     e.preventDefault();
509                     dateChanged = true;
510                 }
511                 break;
512             case 13: // enter
513                 this.setValue(this.formatDate(this.date));
514                 this.hide();
515                 e.preventDefault();
516                 break;
517             case 9: // tab
518                 this.setValue(this.formatDate(this.date));
519                 this.hide();
520                 break;
521             case 16: // shift
522             case 17: // ctrl
523             case 18: // alt
524                 break;
525             default :
526                 this.hide();
527                 
528         }
529     },
530     
531     setStartDate: function(startDate)
532     {
533         this.startDate = startDate || -Infinity;
534         if (this.startDate !== -Infinity) {
535             this.startDate = this.parseDate(this.startDate);
536         }
537         this.update();
538         this.updateNavArrows();
539     },
540
541     setEndDate: function(endDate)
542     {
543         this.endDate = endDate || Infinity;
544         if (this.endDate !== Infinity) {
545             this.endDate = this.parseDate(this.endDate);
546         }
547         this.update();
548         this.updateNavArrows();
549     },
550     
551     setDaysOfWeekDisabled: function(daysOfWeekDisabled)
552     {
553         this.daysOfWeekDisabled = daysOfWeekDisabled || [];
554         if (typeof(this.daysOfWeekDisabled) !== 'object') {
555             this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/);
556         }
557         this.daysOfWeekDisabled = this.daysOfWeekDisabled.map(function (d) {
558             return parseInt(d, 10);
559         });
560         this.update();
561         this.updateNavArrows();
562     },
563     
564     updateNavArrows: function() 
565     {
566         if(this.singleMode){
567             return;
568         }
569         
570         var d = new Date(this.viewDate),
571         year = d.getUTCFullYear(),
572         month = d.getUTCMonth();
573         
574         Roo.each(this.picker().select('.prev', true).elements, function(v){
575             v.show();
576             switch (this.viewMode) {
577                 case 0:
578
579                     if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
580                         v.hide();
581                     }
582                     break;
583                 case 1:
584                 case 2:
585                     if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
586                         v.hide();
587                     }
588                     break;
589             }
590         });
591         
592         Roo.each(this.picker().select('.next', true).elements, function(v){
593             v.show();
594             switch (this.viewMode) {
595                 case 0:
596
597                     if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
598                         v.hide();
599                     }
600                     break;
601                 case 1:
602                 case 2:
603                     if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
604                         v.hide();
605                     }
606                     break;
607             }
608         })
609     },
610     
611     moveMonth: function(date, dir)
612     {
613         if (!dir) return date;
614         var new_date = new Date(date.valueOf()),
615         day = new_date.getUTCDate(),
616         month = new_date.getUTCMonth(),
617         mag = Math.abs(dir),
618         new_month, test;
619         dir = dir > 0 ? 1 : -1;
620         if (mag == 1){
621             test = dir == -1
622             // If going back one month, make sure month is not current month
623             // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
624             ? function(){
625                 return new_date.getUTCMonth() == month;
626             }
627             // If going forward one month, make sure month is as expected
628             // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
629             : function(){
630                 return new_date.getUTCMonth() != new_month;
631             };
632             new_month = month + dir;
633             new_date.setUTCMonth(new_month);
634             // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
635             if (new_month < 0 || new_month > 11)
636                 new_month = (new_month + 12) % 12;
637         } else {
638             // For magnitudes >1, move one month at a time...
639             for (var i=0; i<mag; i++)
640                 // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
641                 new_date = this.moveMonth(new_date, dir);
642             // ...then reset the day, keeping it in the new month
643             new_month = new_date.getUTCMonth();
644             new_date.setUTCDate(day);
645             test = function(){
646                 return new_month != new_date.getUTCMonth();
647             };
648         }
649         // Common date-resetting loop -- if date is beyond end of month, make it
650         // end of month
651         while (test()){
652             new_date.setUTCDate(--day);
653             new_date.setUTCMonth(new_month);
654         }
655         return new_date;
656     },
657
658     moveYear: function(date, dir)
659     {
660         return this.moveMonth(date, dir*12);
661     },
662
663     dateWithinRange: function(date)
664     {
665         return date >= this.startDate && date <= this.endDate;
666     },
667
668     
669     remove: function() 
670     {
671         this.picker().remove();
672     }
673    
674 });
675
676 Roo.apply(Roo.bootstrap.DateField,  {
677     
678     head : {
679         tag: 'thead',
680         cn: [
681         {
682             tag: 'tr',
683             cn: [
684             {
685                 tag: 'th',
686                 cls: 'prev',
687                 html: '<i class="fa fa-arrow-left"/>'
688             },
689             {
690                 tag: 'th',
691                 cls: 'switch',
692                 colspan: '5'
693             },
694             {
695                 tag: 'th',
696                 cls: 'next',
697                 html: '<i class="fa fa-arrow-right"/>'
698             }
699
700             ]
701         }
702         ]
703     },
704     
705     content : {
706         tag: 'tbody',
707         cn: [
708         {
709             tag: 'tr',
710             cn: [
711             {
712                 tag: 'td',
713                 colspan: '7'
714             }
715             ]
716         }
717         ]
718     },
719     
720     footer : {
721         tag: 'tfoot',
722         cn: [
723         {
724             tag: 'tr',
725             cn: [
726             {
727                 tag: 'th',
728                 colspan: '7',
729                 cls: 'today'
730             }
731                     
732             ]
733         }
734         ]
735     },
736     
737     dates:{
738         en: {
739             days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
740             daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
741             daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
742             months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
743             monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
744             today: "Today"
745         }
746     },
747     
748     modes: [
749     {
750         clsName: 'days',
751         navFnc: 'Month',
752         navStep: 1
753     },
754     {
755         clsName: 'months',
756         navFnc: 'FullYear',
757         navStep: 1
758     },
759     {
760         clsName: 'years',
761         navFnc: 'FullYear',
762         navStep: 10
763     }]
764 });
765
766 Roo.apply(Roo.bootstrap.DateField,  {
767   
768     template : {
769         tag: 'div',
770         cls: 'datepicker dropdown-menu roo-dynamic',
771         cn: [
772         {
773             tag: 'div',
774             cls: 'datepicker-days',
775             cn: [
776             {
777                 tag: 'table',
778                 cls: 'table-condensed',
779                 cn:[
780                 Roo.bootstrap.DateField.head,
781                 {
782                     tag: 'tbody'
783                 },
784                 Roo.bootstrap.DateField.footer
785                 ]
786             }
787             ]
788         },
789         {
790             tag: 'div',
791             cls: 'datepicker-months',
792             cn: [
793             {
794                 tag: 'table',
795                 cls: 'table-condensed',
796                 cn:[
797                 Roo.bootstrap.DateField.head,
798                 Roo.bootstrap.DateField.content,
799                 Roo.bootstrap.DateField.footer
800                 ]
801             }
802             ]
803         },
804         {
805             tag: 'div',
806             cls: 'datepicker-years',
807             cn: [
808             {
809                 tag: 'table',
810                 cls: 'table-condensed',
811                 cn:[
812                 Roo.bootstrap.DateField.head,
813                 Roo.bootstrap.DateField.content,
814                 Roo.bootstrap.DateField.footer
815                 ]
816             }
817             ]
818         }
819         ]
820     }
821 });
822
823  
824
825  
826