Mercurial > lada > lada-client
annotate resources/datetime/UX_TimePickerField.js @ 429:608a1784a8ac
Load currently "selected" verwaltungseinheit when changing the selection.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 08 Nov 2013 12:46:24 +0100 |
parents | a282da79cfaa |
children |
rev | line source |
---|---|
273
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 /** |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 * 时间输入框, 三个整数框分别输入时,分,秒. |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 * @author wangzilong |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 * update Ext - 4.1 2012/04/27 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 */ |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 Ext.define('Ext.ux.form.TimePickerField', { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 extend: 'Ext.form.field.Base', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 alias: 'widget.timepicker', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 alternateClassName: 'Ext.form.field.TimePickerField', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 requires: ['Ext.form.field.Number'], |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 // 隐藏BaseField的输入框 , hidden basefield's input |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 inputType: 'hidden', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 style: 'padding:4px 0 0 0;margin-bottom:0px', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 /** |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 * @cfg {String} value |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 * initValue, format: 'H:i:s' |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 */ |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
21 value: null, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
22 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
23 /** |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
24 * @cfg {Object} spinnerCfg |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
25 * 数字输入框参数, number input config |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
26 */ |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 spinnerCfg: { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 width: 40 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
30 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 /** Override. */ |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 initComponent: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 var me = this; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 me.value = me.value || Ext.Date.format(new Date(), 'H:i:s'); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 me.callParent();// called setValue |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 me.spinners = []; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 var cfg = Ext.apply({}, me.spinnerCfg, { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 readOnly: me.readOnly, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 disabled: me.disabled, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 style: 'float: left', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 listeners: { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 change: { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 fn: me.onSpinnerChange, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 scope: me |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 }); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 me.hoursSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
53 minValue: 0, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 maxValue: 23 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
55 })); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 me.minutesSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
57 minValue: 0, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
58 maxValue: 59 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
59 })); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
60 // TODO 使用timeformat 判断是否创建秒输入框, maybe second field is not always need. |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
61 me.secondsSpinner = Ext.create('Ext.form.field.Number', Ext.apply({}, cfg, { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
62 minValue: 0, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
63 maxValue: 59 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
64 })); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
65 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
66 me.spinners.push(me.hoursSpinner, me.minutesSpinner, me.secondsSpinner); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
67 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
68 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
69 /** |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
70 * @private |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 * Override. |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
72 */ |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
73 onRender: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
74 var me = this, spinnerWrapDom, spinnerWrap; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
75 me.callParent(arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
76 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
77 // render to original BaseField input td |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
78 // spinnerWrap = Ext.get(Ext.DomQuery.selectNode('div', this.el.dom)); // 4.0.2 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
79 spinnerWrapDom = Ext.dom.Query.select('td', this.getEl().dom)[1]; // 4.0 ->4.1 div->td |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
80 spinnerWrap = Ext.get(spinnerWrapDom); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
81 me.callSpinnersFunction('render', spinnerWrap); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
82 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
83 Ext.core.DomHelper.append(spinnerWrap, { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
84 tag: 'div', |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
85 cls: 'x-form-clear-left' |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
86 }); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
87 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
88 this.setRawValue(this.value); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
89 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
90 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
91 _valueSplit: function(v) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
92 if(Ext.isDate(v)) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
93 v = Ext.Date.format(v, 'H:i:s'); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
94 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
95 var split = v.split(':'); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
96 return { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
97 h: split.length > 0 ? split[0] : 0, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
98 m: split.length > 1 ? split[1] : 0, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
99 s: split.length > 2 ? split[2] : 0 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
100 }; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
101 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
102 onSpinnerChange: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
103 if(!this.rendered) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
104 return; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
105 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
106 this.fireEvent('change', this, this.getValue(), this.getRawValue()); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
107 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
108 // 依次调用各输入框函数, call each spinner's function |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
109 callSpinnersFunction: function(funName, args) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
110 for(var i = 0; i < this.spinners.length; i++) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
111 this.spinners[i][funName](args); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
112 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
113 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
114 // @private get time as object, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
115 getRawValue: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
116 if(!this.rendered) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
117 var date = this.value || new Date(); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
118 return this._valueSplit(date); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
119 } else { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
120 return { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
121 h: this.hoursSpinner.getValue(), |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
122 m: this.minutesSpinner.getValue(), |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
123 s: this.secondsSpinner.getValue() |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
124 }; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
125 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
126 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
127 |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
128 // private |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
129 setRawValue: function(value) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
130 value = this._valueSplit(value); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
131 if(this.hoursSpinner) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
132 this.hoursSpinner.setValue(value.h); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
133 this.minutesSpinner.setValue(value.m); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
134 this.secondsSpinner.setValue(value.s); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
135 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
136 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
137 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
138 getValue: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
139 var v = this.getRawValue(); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
140 return Ext.String.leftPad(v.h, 2, '0') + ':' + Ext.String.leftPad(v.m, 2, '0') + ':' |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
141 + Ext.String.leftPad(v.s, 2, '0'); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
142 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
143 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
144 setValue: function(value) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
145 this.value = Ext.isDate(value) ? Ext.Date.format(value, 'H:i:s') : value; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
146 if(!this.rendered) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
147 return; |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
148 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
149 this.setRawValue(this.value); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
150 this.validate(); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
151 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
152 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
153 disable: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
154 this.callParent(arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
155 this.callSpinnersFunction('disable', arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
156 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
157 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
158 enable: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
159 this.callParent(arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
160 this.callSpinnersFunction('enable', arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
161 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
162 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
163 setReadOnly: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
164 this.callParent(arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
165 this.callSpinnersFunction('setReadOnly', arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
166 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
167 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
168 clearInvalid: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
169 this.callParent(arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
170 this.callSpinnersFunction('clearInvalid', arguments); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
171 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
172 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
173 isValid: function(preventMark) { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
174 return this.hoursSpinner.isValid(preventMark) && this.minutesSpinner.isValid(preventMark) |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
175 && this.secondsSpinner.isValid(preventMark); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
176 }, |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
177 // overwrite |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
178 validate: function() { |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
179 return this.hoursSpinner.validate() && this.minutesSpinner.validate() && this.secondsSpinner.validate(); |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
180 } |
a282da79cfaa
Added datetimepicker from
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
181 }); |