PDA

View Full Version : Problem while adding tooltip to textfield



dev_java
25 Feb 2011, 6:46 AM
Hi,

I have problem while adding tool tip to textfields in a fieldset.
I have a fieldset with id current_leftPanel which has 10 textfields. I need to give tooltip for all items.

Sample item is as follows


{
xtype: 'textfield',
fieldLabel: 'Sample ID',
width:150,
tooltip:'hello',
id:'sample_id',
disabled:false
}


I wrote a listener on fieldset render property as follows


listeners:{
'render':function(){
var items = Ext.getCmp('current_leftPanel').items;
for (i = 0; i < items.getCount(); ++i) {
var myField = items.get(i);
if (myField.tooltip) {
Ext.QuickTips.register( {
target : myField.getEl(), -- this is getting as undefined
text : myField.tooltip
});
}
}
}
}


Control is coming till the if loop . When i tried to give alert for myField.tooltip, it is displayed correctly as hello. But tool tip is not displayed for the textfield.

when i checked myField.getEl() is 'undefined'. Why myField .getEl() is coming as undefined?
Can anyone help me on fixing this?

Thanks in Advance

laurentParis
25 Feb 2011, 8:09 AM
For me, you need on init code doing :



Ext.QuickTips.init();


nothing else ! (remove your listener code)

myField.getEl() return undefined until myField is not rendered