3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
8 * @class Ext.calendar.CalendarPicker
9 * @extends Ext.form.ComboBox
10 * <p>A custom combo used for choosing from the list of available calendars to assign an event to.</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 fieldLabel: 'Calendar',
14 valueField: 'CalendarId',
15 displayField: 'Title',
22 * @param {Object} config The config object
24 Ext.calendar.CalendarPicker = Ext.extend(Ext.form.ComboBox, {
25 fieldLabel: 'Calendar',
26 valueField: 'CalendarId',
27 displayField: 'Title',
34 initComponent: function() {
35 Ext.calendar.CalendarPicker.superclass.initComponent.call(this);
36 this.tpl = this.tpl ||
37 '<tpl for="."><div class="x-combo-list-item ext-color-{' + this.valueField +
38 '}"><div class="ext-cal-picker-icon"> </div>{' + this.displayField + '}</div></tpl>';
42 afterRender: function() {
43 Ext.calendar.CalendarPicker.superclass.afterRender.call(this);
45 this.wrap = this.el.up('.x-form-field-wrap');
46 this.wrap.addClass('ext-calendar-picker');
48 this.icon = Ext.DomHelper.append(this.wrap, {
50 cls: 'ext-cal-picker-icon ext-cal-picker-mainicon'
55 setValue: function(value) {
56 this.wrap.removeClass('ext-color-' + this.getValue());
57 if (!value && this.store !== undefined) {
58 // always default to a valid calendar
59 value = this.store.getAt(0).data.CalendarId;
61 Ext.calendar.CalendarPicker.superclass.setValue.call(this, value);
62 this.wrap.addClass('ext-color-' + value);
66 Ext.reg('calendarpicker', Ext.calendar.CalendarPicker);