PDA

View Full Version : Form textfield and quicktips, why aren't they showing?



Khandrish
1 Sep 2013, 9:38 PM
I'm calling

Ext.tip.QuickTipManager.init();
in the first, main, controller that loads inside the init function, and I know that the code gets called since other things are run after it that work.

Later on, when a window is opened to login, I have this field defined


{ xtype: 'textfield',
name: 'username',
fieldLabel: 'Username',
allowBlank: false,
emptyText: 'Required',
minLength: 8,
maxLength: 50,
validateOnChange: true,
listeners: {
afterrender: {
fn: function(field, eventOpts) {
setTimeout(function() {
field.focus();
}, 10);


Ext.tip.QuickTipManager.register({
target: field.getEl(),
text: 'test'
});
}
}
}
}

However, if I hover over that textfield nothing happens. I can create a tooltip and get that to show, but I am at a loss as to why the above code isn't working. Anyone have any thoughts? I'm running 4.2.1.

Farish
1 Sep 2013, 11:54 PM
In your afterrender listener, try this instead:


//Ext.tip.QuickTipManager.register({
Ext.create('Ext.tip.ToolTip', {
target: field.getEl(),
trackMouse: true, // optional
html: 'test'
});

Khandrish
2 Sep 2013, 7:24 AM
It looks like I should pay more attention to the comments in the documentation, as in this case the answer is there. Apparently something changed in 4.2 and the best (only?) way to get this to work is to use getId() on the target you want the quicktip to display. So, it needs to look like:


Ext.tip.QuickTipManager.register({
target: field.getId(),
html: '<p>test</p>',
text: 'test'
});