我想放在标题的文本和图标,可点击我的面板,类似这样的: 如何在Ext.Panel头文件中放置文本和可点击的图标?
,我发现了一些old hacks from 2008 to do this,但可以想像,ExtJS的较新版本让你把文字和图标在面板标题中以更直接的方式。
在Ext.Panel头文件中放置文本和可点击图标的最直接方法是什么?
附录
感谢@Stefan奏效,这里是我的解决方案:
的Javascript:
var grid_shopping_cart = new Ext.grid.GridPanel({
headerCfg: {
tag: 'div',
cls: 'x-panel-header',
children: [
{ tag: 'div', cls: 'panel_header_main', 'html': 'Shopping Cart' },
{ tag: 'div', cls: 'panel_header_icon1', 'html': '<img src="images/icon_plus.png" />' },
{ tag: 'div', cls: 'panel_header_extra', 'html': 'Order Number: 2837428347' }
]
},
width: 600,
height: 390,
...
listeners: {
'afterrender' : function(p) {
p.header.on('click', function(e, h) {
alert('you clicked the plus');
}, p, {
delegate: '.panel_header_icon1',
stopEvent: true
});
},
...
CSS:
div.panel_header_main {
text-align: left;
float: left;
}
div.panel_header_extra {
text-align: left;
float: right;
margin-right: 10px;
}
div.panel_header_icon1 {
text-align: right;
float: right;
margin-left: 3px;
cursor: hand;
cursor: pointer;
}
div.panel_header_icon2 {
text-align: right;
float: right;
margin-left: 3px;
cursor: hand;
cursor: pointer;
}
现在有更好的方法来做到这一点,我们在extjs 4.1.3? – Awalias 2013-02-19 14:54:05