View Full Version : addListeners problem

26 Nov 2011, 5:27 PM
there is a togglefield in componentView's item, i want to listen the change event of togglefield control. if i do this as following:

{ xtype: 'togglefield',
listeners: {
change: function (me, thumb, value, options) {

if(value == 1) {
else {

the change event of first item in componentView can be catched when i tap the toggle of first item. but the change event of other items in componentView can't be catched. Why?

So i want to add a listener for togglefield in initialize function, how to write the addListeners code??

Ext.define('ShopSystem.view.SyohinZanListItem', {
extend: 'Ext.dataview.DataItem',
initialize: function(){ this.down('title').setTitle(this._syohin_name.getHtml());
var s2 = this.down('togglefield');
s2.addListener(.....) ???

26 Nov 2011, 6:28 PM
i get it, thanks everyone.

var s2 = this.down('togglefield'); s2.on({
change: this.onToggleChanged