4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-menu-ColorPicker'>/**
19 </span> * @class Ext.menu.ColorPicker
20 * @extends Ext.menu.Menu
21 * <p>A menu containing a {@link Ext.picker.Color} Component.</p>
22 * <p>Notes:</p><div class="mdetail-params"><ul>
23 * <li>Although not listed here, the <b>constructor</b> for this class
24 * accepts all of the configuration options of <b>{@link Ext.picker.Color}</b>.</li>
25 * <li>If subclassing ColorMenu, any configuration options for the ColorPicker must be
26 * applied to the <tt><b>initialConfig</b></tt> property of the ColorMenu.
27 * Applying {@link Ext.picker.Color ColorPicker} configuration settings to
28 * <b><tt>this</tt></b> will <b>not</b> affect the ColorPicker's configuration.</li>
29 * </ul></div>
30 * {@img Ext.menu.ColorPicker/Ext.menu.ColorPicker.png Ext.menu.ColorPicker component}
32 var colorPicker = Ext.create('Ext.menu.ColorPicker', {
36 Ext.create('Ext.menu.Menu', {
39 floating: false, // usually you want this set to True (default)
40 renderTo: Ext.getBody(), // usually rendered by it's containing component
42 text: 'choose a color',
53 * @author Nicolas Ferrero
55 Ext.define('Ext.menu.ColorPicker', {
56 extend: 'Ext.menu.Menu',
58 alias: 'widget.colormenu',
64 <span id='Ext-menu-ColorPicker-cfg-hideOnClick'> /**
65 </span> * @cfg {Boolean} hideOnClick
66 * False to continue showing the menu after a date is selected, defaults to true.
70 <span id='Ext-menu-ColorPicker-cfg-pickerId'> /**
71 </span> * @cfg {String} pickerId
72 * An id to assign to the underlying color picker. Defaults to <tt>null</tt>.
76 <span id='Ext-menu-ColorPicker-cfg-maxHeight'> /**
77 </span> * @cfg {Number} maxHeight
81 <span id='Ext-menu-ColorPicker-property-picker'> /**
82 </span> * The {@link Ext.picker.Color} instance for this ColorMenu
87 <span id='Ext-menu-ColorPicker-event-click'> /**
88 </span> * @event click
92 <span id='Ext-menu-ColorPicker-event-itemclick'> /**
93 </span> * @event itemclick
97 initComponent : function(){
102 showSeparator: false,
104 cls: Ext.baseCSSPrefix + 'menu-color-item',
110 me.callParent(arguments);
112 me.picker = me.down('colorpicker');
114 <span id='Ext-menu-ColorPicker-event-select'> /**
115 </span> * @event select
116 * Fires when a date is selected from the {@link #picker Ext.picker.Color}
117 * @param {Ext.picker.Color} picker The {@link #picker Ext.picker.Color}
118 * @param {String} color The 6-digit color hex code (without the # symbol)
120 me.relayEvents(me.picker, ['select']);
122 if (me.hideOnClick) {
123 me.on('select', me.hidePickerOnSelect, me);
127 <span id='Ext-menu-ColorPicker-method-hidePickerOnSelect'> /**
128 </span> * Hides picker on select if hideOnClick is true
131 hidePickerOnSelect: function() {
132 Ext.menu.Manager.hideAll();