[b]我想要在XTtemplate中添加一个链接的单击事件,当点击链接在同一页面的另一个Panel中显示数据并重新加载,请问怎么做呀?[/b]
[color=blue]XTtemplate中自带的事件不行,因为它在进入页面时就加载了,我要点击之后才加载。[/color]
下面的我的[b]ExtJS代码[/b]:
createFlowConsole : function() {
var data = ['actionId','name'];
this.store = new Ext.data.JsonStore({
url: _ctx.base + '/osworkeflow/getAvailableActions.action',
root:'action',
fields: data
});
var xtpl = new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="xindex % 2 == 1">',
'<div class="x-grid3-cell-inner" style="font-size:10px; background-color:#FFFFFF; border-bottom:1px solid #EDEDED"">',
'<span class="" style=" padding-left:30px;"><a id="showMySteps" href="javaScript: onclick={[this.test()]}">{name}</a></span></div>',
'</tpl>',
'<tpl if="xindex % 2 == 0">',
'<div class="x-grid3-cell-inner" style="font-size:10px; background-color:#FAFAFA; border-bottom:1px solid #EDEDED"">',
'<span class="" style=" padding-left:30px;"><a href="#">{name}</a></span></div>',
'</tpl>',
'</tpl>',{
test : function(){
alert("ok");
}
}
);
this.availableActionsPanel = new Ext.Panel( {
id : 'mySteps_panel',
region : 'north',
title : '我的步骤',
margins : '0 0 5 0',
height : 150,
items: new Ext.DataView({
store: this.store,
tpl: xtpl,
autoHeight:true,
multiSelect: true,
overClass:'x-view-over',
itemSelector:'div.thumb-wrap',
emptyText: 'No data to display'
})
});
this.steps = this.createSetpsGrid();
var flowConsole = new Ext.Panel( {
region : 'center',
layout : "border",
border : false,
items : [ this.availableActionsPanel, this.steps ],
margins : '5 5 5 0'
});
return flowConsole;
}
详细如下附件图所示 :