0
我需要在我的数据视图中添加一个按钮。请参考下面无法将按钮添加到tpl数据视图sencha
Ext.define("blackbutton.view.Setup.test", {
extend: "Ext.DataView",
xtype: 'abc',
requires: [
'Ext.plugin.ListPaging',
'Ext.plugin.PullRefresh',
'Ext.field.Search',
'Ext.List',
'blackbutton.store.Blue.BlueList',
'Ext.ux.PullRefresh.PullRefreshFn',
'blackbutton.store.Blue.BlueList_Off9'
],
config: {
title: 'Transactions',
id: 'abc',
store: {
fields: ['name', 'age'],
data: [
{name: 'Jamie', age: 22},
{name: 'Rob', age: 14},
{name: 'Tommy', age: 22},
{name: 'Jacky', age: 16},
{name: 'Ed', age: 26}
]
},
itemTpl: new Ext.XTemplate(
'<p>{name}',
'<tpl if="age > 17">',
'<p>{age}</p>',
'<p id="{age}"></p>',
'</tpl>',
'</p>'
),
listeners: {
initialize: function()
{
new Ext.Button({
renderTo:'22'
, text:'Vote'
, width:100
, handler:function(){
alert('Vote Button is clicked');
}
})
}
}
}
});
屏幕拍摄
按钮没有出现在我的代码。顺便说一句,我知道我必须将<button>123<button>
添加到itemTpl。但这不是我想要的。我只想添加Ext.Button到tpl。请给我一些解决方案。谢谢。
[this](http://www.sencha.com/forum/showthread.php?118790-Buttons-(and-other-widgets)-in-Ext.List-or-Ext.DataView)may help – Viswa