PDA

View Full Version : simple color picker



frankandangel
24 Mar 2011, 1:13 AM
I have write a plugin to pick color after textfield.
if you like it, use it free

1st just put it before you use it.


Ext.form.colorPicker = Ext.extend(Ext.form.TextField,{
fieldLabel:"取色框",
value:"#000",
id:"colorPicker",
listeners:{
"focus":function(){
var w = new Ext.Window({
x:this.getPosition()[0]+120,
y:this.getPosition()[1],
title:"test",
items:[
{xtype:"colorpalette",id:"innerColorPicker",listeners:{"select":function(palette, selColor){Ext.getDom("colorPicker").value = "#"+selColor;w.hide();}}}
]
});
w.show();
}
}
});

Ext.reg('colorPicker', Ext.form.colorPicker);


Then use it :

var panel=new Ext.form.FormPanel({
frame:true,
layout:'form',
labelAlign:'right',
renderTo:"testForm",
width:400,
items:[{
xtype:"colorPicker",
name:'color'
}]
});


this plugin have been large used in http://www.51widget.com/

micgala
24 Mar 2011, 5:33 AM
Probably you should post this in the ext part of the forum, instead of gxt...

aasshishpatil
8 May 2013, 10:09 PM
i m getting error ext.js is not function