-
how to add listeners for html dom in controller?
how to add listeners for html dom in controller?
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?
-
Sencha - Senior Forum Manager
this.control can only listen to components as the string selector is a ComponentQuery selector.
In order to do this, you have to add a listener to the element after it has been created.
-
var ojfile = document.getElementById('readjsonfile');
ojfile.addEventListener("change", this.onReadJsonContent, false);
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us