janksen
25 Dec 2011, 12:07 AM
When i tried to add listeners for html dom,but it doesn't work.
this is my code:
view:
.....//some code
items:
[
{
docked: 'right',
width: 104,
id: 'test',
html: ['<div class="grid_item grid_item_7 sidebtn" id="login_btn_exit">退出</div>',
'<div class="grid_item grid_item_7 sidebtn" id="login_btn_delete" >删除</div>'].join('')
}
]
....//some code
//my controller code
....//some code
init: function() {
this.control({
'div[id="login_btn_delete"]':
{
tap: this.onBtnExitTap
},
'#login_btn_delete':
{
tap: this.onBtnDeleteTap
}
},
onBtnExitTap:function()
{
alert('exit');//it doesn't work
},
onBtnDeleteTap:function()
{
alert('delete'); // it doesn't work
},
sorry for my pool English,any body can understand my problem and give me some help?
this is my code:
view:
.....//some code
items:
[
{
docked: 'right',
width: 104,
id: 'test',
html: ['<div class="grid_item grid_item_7 sidebtn" id="login_btn_exit">退出</div>',
'<div class="grid_item grid_item_7 sidebtn" id="login_btn_delete" >删除</div>'].join('')
}
]
....//some code
//my controller code
....//some code
init: function() {
this.control({
'div[id="login_btn_delete"]':
{
tap: this.onBtnExitTap
},
'#login_btn_delete':
{
tap: this.onBtnDeleteTap
}
},
onBtnExitTap:function()
{
alert('exit');//it doesn't work
},
onBtnDeleteTap:function()
{
alert('delete'); // it doesn't work
},
sorry for my pool English,any body can understand my problem and give me some help?