PDA

View Full Version : Enable and disable extjs tooltip from toolbar items



msafeer
7 Jun 2011, 4:39 AM
n my toolbar there is checkbox used for enabling and disabling tooltip.If the checkbox is checked then i should enable tooltip and it is working if not then i should disable it also working. after disabling tooltip when click on toolbar not on any item in the toolbar then also it is enabling toogleTooltip is a handler of checkbox


function toggleTooltip() {
debugger;
if(Ext.getCmp("msai_tool_tip").checked) {
Ext.QuickTips.enable();
while(!Ext.QuickTips.isEnabled())
Ext.QuickTips.enable();
}
else {
Ext.QuickTips.disable();
while(Ext.QuickTips.isEnabled())
Ext.QuickTips.disable(); }
}


this is my toolbar creation code



Ext.QuickTips.init();
var tb = new Ext.Toolbar({
id:'form_menu_bar',
renderTo: Ext.get('newproducttitle').dom,
items: [
{
tooltip:
{ text: "Click on this button to generate the template and save it in server.",
title: "Save" ,
xtype: "quicktip"
} ,
iconCls : 'msai_save_template' ,
handler : generateTemplate
},
{
tooltip:
{
text: "Click on this button to generate the template.",
title: "Save to clipboard" ,
xtype: "quicktip"
}
, iconCls : 'msai_save_clipboard'
, handler : generateTemplateClipboard

}]});

please suggest some solution so that i should not show tooltip if user click on toolbar not in any item

skirtle
9 Jun 2011, 11:06 PM
You haven't included the code for the creation of the checkbox itself, which makes guessing what the problem is a little harder. I'd speculate that when you click on the toolbar what you're actually doing is clicking on the label element associated with the checkbox. Try adding boxLabel: '' to your checkbox config to stop that element being created.

Also, the while loops in toggleTooltip() seem completely unnecessary.