PDA

View Full Version : number field: problem with listener



TheMonolith
3 Mar 2010, 6:27 AM
Can somebody tell me why giving the number field the focus (e.g. by clicking on it) doesn't cause the panel with the id "testID" to become invisible (while the alert("xxx") works)?

I highlighted the important parts of the code with blue.



{
xtype: "fieldset",
title: "Textfarbe",
autoHeight: true,
layout: "column",
items:
[{
xtype: "form",
border: false,
labelAlign: "top",
title: "",
width: "20%",
labelWidth: 35,
items:
[{
xtype: "numberfield",
fieldLabel: "C",
width: 35,
allowDecimals: false,
allowNegative: false,
maxValue: "100",
autoCreate:
{
tag: 'input',
type: 'number',
name: 'state',
maxlength: 3
},
listeners:
{
focus: function()
{
Ext.getCmp('testID').setVisible('false');
alert("xxx");
}
}
}]
},
{
xtype: "form",
border: false,
labelAlign: "top",
title: "",
width: "20%",
labelWidth: 70,
items:
[{
xtype: "panel",
id: "testID",
border: false,
bodyStyle: 'background-color:rgb(255, 0, 255);',
fieldLabel: "Vorschau",
width: 40,
height: 30
}]
}]
}

senacle
13 Oct 2010, 4:28 AM
Have you tried :


Ext.getCmp('testID').hide();

?

Condor
13 Oct 2010, 4:34 AM
Don't use a string when you want a boolean!

'false' == true