PDA

View Full Version : Apply tooltip dynamically to tools items on panel



DineshGudikandula
10 Jan 2013, 8:01 AM
Hi all...
How to apply tooltip dynamically to tools items on panel?

My code is like:


xtype: 'panel',
region: 'south',
title: 'Playground',
collapsible: true,
tools:[{
type:'restore',
collapsed : false,
handler: function( event, toolEl, panel ){

if( this.collapsed == false ){
//Here apply tooltip str as "Expanded"
}else{
//Here apply tooltip str as "Collapsed"
}
}
}]


This panel is a part of viewport in center region.
I try with this.setTooltip('str'),but it is showing undefined.
Help me..
Thanks in advance

friend
10 Jan 2013, 10:27 AM
If I remember correctly, Tool items are hidden when a panel collapses, so this is kind of a moot point.

Regardless:



xtype: 'panel',
region: 'south',
title: 'Playground',
collapsible: true,
tools:[{
type:'restore',
collapsed : false,
handler: function( event, toolEl, panel ) {
if( this.up('panel').getCollapsed() == false ){
Ext.create('Ext.tip.ToolTip', {
target: tool.el,
html: 'This panel is expanded!'
});
}else{
// Tools are hidden when collapsed, so this is pointless...
}
}
}]


When a panel is set as collapsible: true, you already get a default tool item which indicates the collapsed/expanded state. Why not just use the default tool provided?

DineshGudikandula
10 Jan 2013, 9:35 PM
Hi friend...thanks for reply
But i want develop the Maximize,Restore functionality for that tool button,
My requirement is when user first time mouse over show the "Maximize" tooltip,After click on the tool button and mouse over it show the "Restore" tooltip...


Can u help..?

DineshGudikandula
16 Jan 2013, 8:20 PM
Is there any help for achieve this requirement?