X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..10a866c12701c0a0afd0ac85dcdcf32a421514ac:/docs/source/ColorPalette.html?ds=inline
diff --git a/docs/source/ColorPalette.html b/docs/source/ColorPalette.html
index 723fc9d4..1a55258e 100644
--- a/docs/source/ColorPalette.html
+++ b/docs/source/ColorPalette.html
@@ -1,5 +1,6 @@
+
The source code
@@ -23,23 +24,7 @@ cp.on('select', function(palette, selColor){
* @param {Object} config The config object
* @xtype colorpalette
*/
-Ext.ColorPalette = function(config){
- Ext.ColorPalette.superclass.constructor.call(this, config);
- this.addEvents(
- /**
- * @event select
- * Fires when a color is selected
- * @param {ColorPalette} this
- * @param {String} color The 6-digit color hex code (without the # symbol)
- */
- 'select'
- );
-
- if(this.handler){
- this.on('select', this.handler, this.scope, true);
- }
-};
-Ext.extend(Ext.ColorPalette, Ext.Component, {
+Ext.ColorPalette = Ext.extend(Ext.Component, {
/**
* @cfg {String} tpl An existing XTemplate instance to be used in place of the default template for rendering the component.
*/
@@ -54,6 +39,11 @@ Ext.extend(Ext.ColorPalette, Ext.Component, {
* the hex codes are case-sensitive.
*/
value : null,
+ /**
+ * @cfg {String} clickEvent
+ * The DOM event that will cause a color to be selected. This can be any valid event name (dblclick, contextmenu).
+ * Defaults to 'click'.
+ */
clickEvent :'click',
// private
ctype : 'Ext.ColorPalette',
@@ -102,18 +92,36 @@ cp.colors = ['000000', '993300', '333300'];
* The scope (this reference) in which the {@link #handler}
* function will be called. Defaults to this ColorPalette instance.
*/
+
+ // private
+ initComponent : function(){
+ Ext.ColorPalette.superclass.initComponent.call(this);
+ this.addEvents(
+ /**
+ * @event select
+ * Fires when a color is selected
+ * @param {ColorPalette} this
+ * @param {String} color The 6-digit color hex code (without the # symbol)
+ */
+ 'select'
+ );
+
+ if(this.handler){
+ this.on('select', this.handler, this.scope, true);
+ }
+ },
// private
onRender : function(container, position){
+ this.autoEl = {
+ tag: 'div',
+ cls: this.itemCls
+ };
+ Ext.ColorPalette.superclass.onRender.call(this, container, position);
var t = this.tpl || new Ext.XTemplate(
' '
);
- var el = document.createElement('div');
- el.id = this.getId();
- el.className = this.itemCls;
- t.overwrite(el, this.colors);
- container.dom.insertBefore(el, position);
- this.el = Ext.get(el);
+ t.overwrite(this.el, this.colors);
this.mon(this.el, this.clickEvent, this.handleClick, this, {delegate: 'a'});
if(this.clickEvent != 'click'){
this.mon(this.el, 'click', Ext.emptyFn, this, {delegate: 'a', preventDefault: true});