PDA

View Full Version : How to make controls fire on click?



korndeang
20 Jun 2013, 7:33 PM
I hade id:'clicktowork', when click on that panel is not work


items:[
{
xtype:'panel',
collapsible: true,
margin:'2 2 2 2',
title: 'View',
id:'clicktowork',
html:'<div id="todo_left_panel"><ul><li linktype="all"><sub><img border="0" src="images/extjs/icon-show-all.gif"></sub><a href="#">All</a></li><li linktype="completed"><sub><img border="0" src="images/extjs/icon-show-active.gif"></sub><a href="#">Active Tasks</a></li><li linktype="inactive"><sub><img border="0" src="images/extjs/icon-show-complete.gif"></sub><a href="#">Inactive</a></li></ul></div>'
}
]
and my controller code


'#clicktowork':{
click: this.todoSort
}
..
todoSort: function(){
alert('');
}

skirtle
20 Jun 2013, 10:13 PM
Panel doesn't fire a click event. You can see a list of all of the available events for a panel in the docs.

To add a click event you'll have to wire it up yourself, listening for the click on the el and firing a corresponding event on the panel.

If you need an example I suggest taking a look at the source for Ext.panel.Tool.