PDA

View Full Version : Image ToolTip text is not getting updated



AJAIN32
7 May 2015, 12:33 PM
Hi,

I am using the tooltip component on an image, so whenever the user hover on image icon the tooltip appears -
Ext.create (Ext.tip.ToolTip{
target : imagecomponent.getEl()
html : some dynamic text

})

it is working fine first time as expected, but when i use it again by another search, i have the updated data for which tooltip is coming. But it seems the earlier toolip is not removed and its a new one.

can anyone please tell me how i can remove the tooptip from a image comoponent ? or is there any way to access the same tooltip and update the contents?

Thanks,
Ankit

tristan.lee
11 May 2015, 4:33 AM
Are you creating a new ToolTip each time you want to change the content, or are you updating the existing? You can utilize the beforeshow (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.AbstractComponent-event-beforeshow) event to to change the content prior to the tooltip being displayed.

AJAIN32
11 May 2015, 5:06 AM
Thanks for replying,

I am creating a new tool tip each time which is just an workaround as i was not able to update the content of the tooltip each time.
If i use before show method each time how i can pass the new contents to the tooltip, as its an configuration property. do i need to call the beforeShow method explicitly ?

Any working example which is taking the dynamic contents ?

Thanks,
Ankit

tristan.lee
11 May 2015, 12:54 PM
Here's an example:
mkt

AJAIN32
12 May 2015, 8:21 PM
Thanks for the Fiddle,

I will try it out to get the message updated, can you please suggest how i can pass the dynamic content for the tooltip text in before show event, as i have a need to update the contents each time before show. Any suggestion ?

Thanks,
Ankit

tristan.lee
13 May 2015, 8:44 PM
Sure. Where is your content coming from? Can you provide a fiddle (https://fiddle.sencha.com) demonstrating how you're obtaining the content?