PDA

View Full Version : How can i show ColorPalette on focus event in the textfield ?



debabrata
16 Nov 2011, 3:38 AM
I have seen the example showing ColorPalette by clicking a button.But i want show it in textfield on focus event in the textfield.


var col = new Ext.ColorPalette({
listeners: {
select: function(cp, color){
alert(color);
}
}
});
var frm_color = new Ext.form.TextField({
fieldLabel: 'Add a color',
name: 'color',
id: 'color',
width: 190,
listeners: {
focus : function()
{
item:[col];
}
},
});
what is the alternative method to do it ?

thanks in advance.

mitchellsimoens
18 Nov 2011, 1:48 PM
Probably not 100% what you want but this will render it to the body:


var col = new Ext.ColorPalette({
listeners : {
select : function(cp, color){
console.log(color);
}
}
});

var form = new Ext.form.FormPanel({
renderTo : Ext.getBody(),
width : 400,
height : 400,
items : [
{
xtype : 'textfield',
fieldLabel : 'Test',
listeners : {
focus : function(field) {
col.render(Ext.getBody());
}
}
}
]
});

debabrata
20 Nov 2011, 9:07 PM
Thanks mitchellsimoens .It could be an alternative to that problem. thanks very much.