Mercurial > lada > lada-client
annotate resources/lib/datetime/UX_DateTimeMenu.js @ 582:a241362cda68
Use indexOf instead of contains to check if a substring exists.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 11 Mar 2015 10:13:43 +0100 |
parents | b6875e900e3a |
children |
rev | line source |
---|---|
550
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Ext.ux.DateTimeMenu', { |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.menu.Menu', |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 alias: 'widget.datetimemenu', |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 requires: ['Ext.ux.DateTimePicker'], |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 hideOnClick: true, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 pickerId: null, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 initComponent: function() { |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 var me = this; |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 Ext.apply(me, { |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 showSeparator: false, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 plain: true, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 border: false, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 bodyPadding: 0, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 items: Ext.applyIf({ |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 cls: Ext.baseCSSPrefix + 'menu-date-item', |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 id: me.pickerId, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 xtype: 'datetimepicker' |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 }, me.initialConfig) |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 }); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 me.callParent(arguments); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 me.picker = me.down('datetimepicker'); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 me.relayEvents(me.picker, ['select']); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 if (me.hideOnClick) { |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 me.on('select', me.hidePickerOnSelect, me); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 } |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 }, |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 hidePickerOnSelect: function() { |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 Ext.menu.Manager.hideAll(); |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 } |
b6875e900e3a
Added datetime library.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 }); |