|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
dockedItems: [{
xtype:'pagingtoolbar',
dock:'bottom',
displayInfo:true,
store:'Countries',
items: [
{
xtype:'tbseparator'
},
{
id :'myTip1',
xtype :'button',
text:'ToolTip Example 1',
tooltip:'Tool Tip added in the View definition ...'
},
{
id :'myTip2',
xtype :'button',
text:'ToolTip Example 2',
}
]
}],
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
init :function() {
this.control({
......
......
'countryList button[id=myTip2]': {
render :this.onButtonRendered
}
});
},
onButtonRendered :function() {
console.log('The ToolTip Button was rendered');
//create the ToolTip
Ext.create('Ext.tip.ToolTip', {
target:'myTip2',
html:'Tool Tip added later from the app controller ...'
});
}
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
initComponent:function() {
this.columns = [{
header:'Country Code',
dataIndex:'code',
flex: 1,
renderer :function(value, metadata, record) {
myToolTipText ="<b>Tool Tip added using renderer function for country</b>";
myToolTipText = myToolTipText +"
Code: "+ record.get('name');
myToolTipText = myToolTipText +"
Name: "+ record.get('name');
myToolTipText = myToolTipText +"
Continent: "+ record.get('continent');
myToolTipText = myToolTipText +"
Region: "+ record.get('region');
metadata.tdAttr ='data-qtip="'+ myToolTipText +'"';
returnvalue;
}
},
{header:'Name', dataIndex:'name', flex: 3}
];
this.callParent(arguments);
}
});
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//create the ToolTip
gridView.tip = Ext.create('Ext.tip.ToolTip', {
// The overall target element.
target: gridView.el,
// Each grid row causes its own seperate show and hide.
delegate: gridView.view.cellSelector,
// Moving within the row should not hide the tip.
trackMouse:true,
// Render immediately so that tip.body can be referenced prior to the first show.
renderTo: Ext.getBody(),
listeners: {
// Change content dynamically depending on which element triggered the show.
beforeshow:functionupdateTipBody(tip) {
gridColums = gridView.view.getGridColumns();
column = gridColums[tip.triggerElement.cellIndex];
//only display the tool tip for name column
if(column.dataIndex ==='name'){
record = gridView.view.getRecord(tip.triggerElement.parentNode);
myToolTipText ="<b>Tool Tip for country added from the controller</b>";
myToolTipText = myToolTipText +"
Code: "+ record.get('name');
myToolTipText = myToolTipText +"
Name: "+ record.get('name');
myToolTipText = myToolTipText +"
Continent: "+ record.get('continent');
myToolTipText = myToolTipText +"
Region: "+ record.get('region');
tip.update(myToolTipText);
}
else{
returnfalse;
}
}
}
});
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
delegate: gridView.view.itemSelector,
beforeshow:functionupdateTipBody(tip) {
record = gridView.view.getRecord(tip.triggerElement);
myToolTipText ="<b>Tool Tip for country added from the controller</b>";
myToolTipText = myToolTipText +"
Code: "+ record.get('name');
myToolTipText = myToolTipText +"
Name: "+ record.get('name');
myToolTipText = myToolTipText +"
Continent: "+ record.get('continent');
myToolTipText = myToolTipText +"
Region: "+ record.get('region');
tip.update(myToolTipText);
}
|