Extjs adding a listener to tree panel returns Uncaught TypeError: Cannot read property 'scope' of undefined -


i trying add selection change listener on tree panel following error: uncaught typeerror: cannot read property 'scope' of undefined

code follows: xxx.view.trees.maintree.js

extend: 'ext.tree.panel',  requires: [      'xxx.store.treestore'  ], xtype: 'main-tree',   height: 400, width: 350, title: 'tree', usearrows: true,  initcomponent: function() {     ext.apply(this, {         store: new xxx.store.treestore(),         listeners:{              selectionchange:this.onclick         }     });     this.callparent(); } 

xxx.store.treestore

extend: 'ext.data.treestore',   proxy: {     type: 'ajax',     url: 'resources/tree-nodes.json' },  root: {     text: 'contacts',     id: 'src',     expanded: true }, 

xxx.view.maincontroller.js

  onclick: function (sender, selected, eopts) {  } 

replace:

selectionchange:this.onclick 

with:

selectionchange: 'onclick' 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -