请教高手,我做个panle模板,然后循环输出这个模板,
请问如何动态改变button的handler function里的参数呢?{ xtype:"container",
layout:"hbox",
height: 25,
items:[{
xtype: 'displayfield',
value: '任务:',
width: 40
},{
xtype: 'displayfield',
value: '2012-03-28',
width: 120
},{
xtype: 'button',
height:20,
text: '导出',
tooltip: '导出历史日志',
handler: function()
{
Ext.Ajax.request({
url:'../ajax/export_log.php',
actionMethods: 'POST',
extraParams: {server: '1',tag: '2'},
success:function(res){
var obj = Ext.decode(res.responseText);
window.location.href = "../ajax/download.php?path="+obj.path;
}
});
}
}//这里是模板
//然后循环输出到host_panel里边
for(i=1,i<3,i++)
{
host_panel.add(innerPanel);
//然后后边怎么写啊??要改变模板里POST的参数
}求高手帮忙啊。。
请问如何动态改变button的handler function里的参数呢?{ xtype:"container",
layout:"hbox",
height: 25,
items:[{
xtype: 'displayfield',
value: '任务:',
width: 40
},{
xtype: 'displayfield',
value: '2012-03-28',
width: 120
},{
xtype: 'button',
height:20,
text: '导出',
tooltip: '导出历史日志',
handler: function()
{
Ext.Ajax.request({
url:'../ajax/export_log.php',
actionMethods: 'POST',
extraParams: {server: '1',tag: '2'},
success:function(res){
var obj = Ext.decode(res.responseText);
window.location.href = "../ajax/download.php?path="+obj.path;
}
});
}
}//这里是模板
//然后循环输出到host_panel里边
for(i=1,i<3,i++)
{
host_panel.add(innerPanel);
//然后后边怎么写啊??要改变模板里POST的参数
}求高手帮忙啊。。
return { xtype:"container",
layout:"hbox",
height: 25,
items:[{
xtype: 'displayfield',
value: '任务:',
width: 40
},{
xtype: 'displayfield',
value: '2012-03-28',
width: 120
},{
xtype: 'button',
height:20,
text: '导出',
tooltip: '导出历史日志',
handler: function()
{
Ext.Ajax.request({
url:'../ajax/export_log.php',
actionMethods: 'POST',
extraParams: params,
success:function(res){
var obj = Ext.decode(res.responseText);
window.location.href = "../ajax/download.php?path="+obj.path;
}
});
}
};
}
//这里是模板
//然后循环输出到host_panel里边
var parameter = [
{},
{server: '1',tag: '1'},
{server: '2',tag: '2'}
];
for(var i=1;i<3;i++){
host_panel.add(getTemplate(parameter[i]));
//然后后边怎么写啊??要改变模板里POST的参数
}
这样写试下