PDA

View Full Version : Set Tooltip zindex or bringToFront



Csegota
24 Oct 2013, 11:01 AM
I have a tooltip that is displayed from a mouseover of some text in a window. The tooltip is set to not close on mouseout. The issues is that if the user clicks the window while the tooltip is displayed, the window is brought to the front, and the tooltip is covered up.

I've tried a number of things to fix this, none have seemed to work

With Ext.ZIndexManager I get a error saying ZIndexManger.register or bringToFront() is not a function.

If I try to setStyle('z-index', '80000') I have to have a reference to the tooltip El, getEl() does not work, because a tooltip doesnt have an El? At least I don't see El in the tooltips dom.

Any ideas on how to solve this issue? using either method described above or something else?
All I really need to do is make sure that tooltip stays on top when the user clicks the window that generates it.

Thanks!
Christian

This is the code I'm using, this is the listener on the tooltip


listeners : {
beforeshow : function(){
if(currentTooltip){
Ext.getCmp(currentTooltip).hide();
}
currentTooltip = id;
//Attempt 1
//var ttEl = Ext.getCmp(id).getEl(); //El is undefined.
//ttEl.setStyle('z-index', '80000');
//Attempt 2
//Ext.ZIndexManager.register(Ext.getCmp(id)); //Ext.ZIndexManager.register is not a function
//Ext.ZIndexManager.bringToFront(Ext.getCmp(id));
}
}

Csegota
24 Oct 2013, 1:24 PM
Update.

El didn't exist in my beforeshow listener because the el hadn't been created yet. I attempted the following but the zindex gets overridden by the framework when the window gets focused. Forcing the tooltip behind anyways.



show: function(obj){
obj.getEl().zindex = 20002;
},


In addition. I tried to use the blur event to simply destroy the tooltip if it loses focus, so that it would just be re-rendered if a user fires mouseover again, the blur event is never firing however?


blur : function(obj){
if (currentTooltip){
Ext.getCmp(currentTooltip).hide();
}
}

I think this approach should fix my problem. Does anyone know why the blur event for tooltip isnt firing when the window is focused and the tooltip is forced behind?