PDA

View Full Version : How to set tooltip for images icon



amanind
18 Jan 2011, 7:11 AM
I am using images for icon
I want to set tooltip on mouseover on image. Please let me know how to set tooltip

Here is my code



xtype: 'box',
autoEl: {
tag: 'img',
src: 'icons/Excel.bmp'
}

Condor
18 Jan 2011, 7:31 AM
Haven't tested, but try:

xtype: 'box',
autoEl: {
tag: 'img',
src: 'icons/Excel.bmp',
qtip: 'Tooltip'
}
(assuming you called Ext.QuickTips.init() as your first line in Ext.onReady)

amanind
18 Jan 2011, 7:39 AM
No Condor, its not working

here is my complete code

{
xtype: 'box',
autoEl: {
tag: 'img',
qtip: 'Tooltip',
src: MS.ImpactSisterApp.SisterWebAppBase + 'icons/Excel.bmp'
},
style: 'cursor:hand',
listeners: {
render: function(c) {
c.el.on({
'click': function() {
var parStr = "?method=generateReportInvestmentModelsStatusFinal";
parStr += "&reportingPeriodId=" + repPeriodCombo.selectedItem.ReportingPeriodId;
parStr += "&reportingName=" + repPeriodCombo.selectedItem.Name;

var url = MS.ImpactSisterApp.impactHttpHandlerUrl + parStr;
MS.ImpactSisterApp.SisterAppEventManager.fireEvent("checkConnection", { "method": "checkConnection", "event": "openNewWindow", "windowName": "DownloadModel", "url": url });
},
scope: c
});
}
}
}

Condor
18 Jan 2011, 7:45 AM
In that case you need:

listeners: {
render: function(c) {
Ext.QuickTips.register({
target: c.el,
text: 'Tooltip'
});
...
}
}

amanind
18 Jan 2011, 10:35 PM
Condor, still there is JS error
I am using 3.1 version of extjs

24343

Condor
18 Jan 2011, 11:26 PM
That would mean that you don't have an Ext.QuickTips. Are you using a custom Ext JS build?

amanind
18 Jan 2011, 11:37 PM
I dont know about that. but from where i will get Ext.QuickTips class or js file

Condor
18 Jan 2011, 11:40 PM
Ext.QuickTips is part of ext-all.js, so the only reason it wouldn't be defined is if you are using a custom build.

amanind
19 Jan 2011, 12:30 AM
Any other solution Condor

I am getting error in ext-all.js file on this line

getQuickTip:function(){return b},register:function(){b.register.apply(b,arguments)}

error: b.register is null

Condor
19 Jan 2011, 12:34 AM
Can you post the error when using ext-all-debug.js instead of ext-all.js?

ps. And you did call Ext.QuickTips.init() at the start of Ext.onReady as I told you?

amanind
19 Jan 2011, 1:21 AM
Condor, it works after adding Ext.QuickTips.init()

Thanks alot