You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. /**
  16. * @class Ext.calendar.CalendarPicker
  17. * @extends Ext.form.ComboBox
  18. * <p>A custom combo used for choosing from the list of available calendars to assign an event to.</p>
  19. * <p>This is pretty much a standard combo that is simply pre-configured for the options needed by the
  20. * calendar components. The default configs are as follows:<pre><code>
  21. fieldLabel: 'Calendar',
  22. valueField: 'CalendarId',
  23. displayField: 'Title',
  24. triggerAction: 'all',
  25. mode: 'local',
  26. forceSelection: true,
  27. width: 200
  28. </code></pre>
  29. * @constructor
  30. * @param {Object} config The config object
  31. */
  32. Ext.calendar.CalendarPicker = Ext.extend(Ext.form.ComboBox, {
  33. fieldLabel: 'Calendar',
  34. valueField: 'CalendarId',
  35. displayField: 'Title',
  36. triggerAction: 'all',
  37. mode: 'local',
  38. forceSelection: true,
  39. width: 200,
  40. // private
  41. initComponent: function() {
  42. Ext.calendar.CalendarPicker.superclass.initComponent.call(this);
  43. this.tpl = this.tpl ||
  44. '<tpl for="."><div class="x-combo-list-item ext-color-{' + this.valueField +
  45. '}"><div class="ext-cal-picker-icon">&nbsp;</div>{' + this.displayField + '}</div></tpl>';
  46. },
  47. // private
  48. afterRender: function() {
  49. Ext.calendar.CalendarPicker.superclass.afterRender.call(this);
  50. this.wrap = this.el.up('.x-form-field-wrap');
  51. this.wrap.addClass('ext-calendar-picker');
  52. this.icon = Ext.DomHelper.append(this.wrap, {
  53. tag: 'div',
  54. cls: 'ext-cal-picker-icon ext-cal-picker-mainicon'
  55. });
  56. },
  57. // inherited docs
  58. setValue: function(value) {
  59. this.wrap.removeClass('ext-color-' + this.getValue());
  60. if (!value && this.store !== undefined) {
  61. // always default to a valid calendar
  62. value = this.store.getAt(0).data.CalendarId;
  63. }
  64. Ext.calendar.CalendarPicker.superclass.setValue.call(this, value);
  65. this.wrap.addClass('ext-color-' + value);
  66. }
  67. });
  68. Ext.reg('calendarpicker', Ext.calendar.CalendarPicker);