Cannot add listeners to store in ExtJS Controller -
in application have button in toolbar. if click on button open window following code executed:
[...] onclick: function() { this.windowcontrol = this.getcontroller('attributesearch.window'); this.windowcontrol.init(); this.windowcontrol.showwindow(); } [...] this window contains inputfields , combobox store:
ext.define('em.store.attributequery', { requires: ['em.model.attributequery'], model: 'em.model.attributequery', proxy: { type: 'ajax', url: './app/configuration/attributequeries.json', reader: { type: 'json', root: 'queries' } }, autoload: true }); within init method of window controller want add 1 onload-listener
try add listener store:
init: function() { this.getattributequerystore().on('load', this.onstoreload, this); this.control({ 'attributesearchwindow': { afterrender: this.onwindowrendered } }); }, the first line in init method this.getattributequerystore().on('load', this.onstoreload, this); produces following error:
uncaught typeerror: object [object object] has no method 'on' app/controller/attributesearch/window.js:9. it seems store not (or correct) instantiated. missing?
edit:
the console output this.getattributequerystore() this:
constructor {self: function, superclass: object, config: emptyfn, initconfiglist: array[0], initconfigmap: object…} __proto__: templateclass $classname: "em.store.attributequery" autoload: true config: emptyfn configmap: templateclass initconfiglist: array[0] initconfigmap: object model: "em.model.attributequery" proxy: object requires: array[1] self: function constructor() { superclass: object __proto__: object }
why don't define store's listener part of store's definition?
ext.define('em.store.attributequery', { requires: ['em.model.attributequery'], model: 'em.model.attributequery', proxy: { type: 'ajax', url: './app/configuration/attributequeries.json', reader: { type: 'json', root: 'queries' } }, autoload: true, listeners: { load: function(store, records, options) { em.getapplication().getcontroller('attributesearch.window').onstoreload(store, records, options); } } });
Comments
Post a Comment