Upgrade to ExtJS 3.3.0 - Released 10/06/2010
[extjs.git] / examples / calendar / src / widgets / ReminderField.js
1 /*!
2  * Ext JS Library 3.3.0
3  * Copyright(c) 2006-2010 Ext JS, Inc.
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 /**
8  * @class Ext.calendar.ReminderField
9  * @extends Ext.form.ComboBox
10  * <p>A custom combo used for choosing a reminder setting for an event.</p>
11  * <p>This is pretty much a standard combo that is simply pre-configured for the options needed by the
12  * calendar components. The default configs are as follows:<pre><code>
13     width: 200,
14     fieldLabel: 'Reminder',
15     mode: 'local',
16     triggerAction: 'all',
17     forceSelection: true,
18     displayField: 'desc',
19     valueField: 'value'
20 </code></pre>
21  * @constructor
22  * @param {Object} config The config object
23  */
24 Ext.calendar.ReminderField = Ext.extend(Ext.form.ComboBox, {
25     width: 200,
26     fieldLabel: 'Reminder',
27     mode: 'local',
28     triggerAction: 'all',
29     forceSelection: true,
30     displayField: 'desc',
31     valueField: 'value',
32
33     // private
34     initComponent: function() {
35         Ext.calendar.ReminderField.superclass.initComponent.call(this);
36
37         this.store = this.store || new Ext.data.ArrayStore({
38             fields: ['value', 'desc'],
39             idIndex: 0,
40             data: [
41             ['', 'None'],
42             ['0', 'At start time'],
43             ['5', '5 minutes before start'],
44             ['15', '15 minutes before start'],
45             ['30', '30 minutes before start'],
46             ['60', '1 hour before start'],
47             ['90', '1.5 hours before start'],
48             ['120', '2 hours before start'],
49             ['180', '3 hours before start'],
50             ['360', '6 hours before start'],
51             ['720', '12 hours before start'],
52             ['1440', '1 day before start'],
53             ['2880', '2 days before start'],
54             ['4320', '3 days before start'],
55             ['5760', '4 days before start'],
56             ['7200', '5 days before start'],
57             ['10080', '1 week before start'],
58             ['20160', '2 weeks before start']
59             ]
60         });
61     },
62
63     // inherited docs
64     initValue: function() {
65         if (this.value !== undefined) {
66             this.setValue(this.value);
67         }
68         else {
69             this.setValue('');
70         }
71         this.originalValue = this.getValue();
72     }
73 });
74
75 Ext.reg('reminderfield', Ext.calendar.ReminderField);