【发布时间】:2011-05-23 16:19:17
【问题描述】:
我想知道,我可以从动态创建的 dijit 按钮传递参数吗?
function testcallfromDynamicButton (value) {
alert(value);
}
var thisButton = new dijit.form.Button({
label : thelineindex ,
id : "I_del_butt"+thelineindex,
name : "I_del_butt"+thelineindex,
onClick : testcallfromDynamicButton('test')
}).placeAt( thetabletd1 ) ;
似乎,这不起作用,我试图改变这个。有效!!
function testcallfromDynamicButton () {
alert('test');
}
var thisButton = new dijit.form.Button({
label : thelineindex ,
id : "I_del_butt"+thelineindex,
name : "I_del_butt"+thelineindex,
onClick : testcallfromDynamicButton
}).placeAt( thetabletd1 ) ;
问题是,我想让函数知道,哪个按钮被点击了(因为所有按钮都是动态创建的,并且按钮id是由indexnumber生成的),所以我需要将按钮本身的id传递给函数.但是通过 onClick 调用传递参数似乎在 Dijit 中不起作用。我怎样才能让它工作?
【问题讨论】:
标签: dojo