mrinsan
25 Sep 2012, 9:49 AM
What i understand from the docs and forum is
in Extjs-MVC controllers are not tied to a view
all the controllers have application wide scope having said that
if i have a controller defined as below then it will trigger refreshGrid function for any button defined in the application (not just for buttons inside a particular view).
or in other words extjs do not provide a way to define a controller for a view. and to overcome this our component selectors must be very specific
Ext.define('MyApp.controller.Users', {
extend: 'Ext.app.Controller',
refs: [{ref:'list', selector:'grid'}],
init: function() {
this.control({
'button': {click: this.refreshGrid}
});
},
refreshGrid: function() {
this.getList().store.load();
}
});
also my understanding is that once a controller event is defined there is no way you can destroy it.
Now my questions are
1. Is my above understanding true ?
2. If true, then for a large project where i have about 60-70 views and many more event listener. should i take the approach of creating widget instead of the views because when you create a widget and destroy it, along with it all its listeners are also destroyed whereas in views the all the listeners in the controller will be active and consume resource .
3. can anyone provide me a way to measure the cost of maintaining a event listeners so that i can take an informed decisions
in Extjs-MVC controllers are not tied to a view
all the controllers have application wide scope having said that
if i have a controller defined as below then it will trigger refreshGrid function for any button defined in the application (not just for buttons inside a particular view).
or in other words extjs do not provide a way to define a controller for a view. and to overcome this our component selectors must be very specific
Ext.define('MyApp.controller.Users', {
extend: 'Ext.app.Controller',
refs: [{ref:'list', selector:'grid'}],
init: function() {
this.control({
'button': {click: this.refreshGrid}
});
},
refreshGrid: function() {
this.getList().store.load();
}
});
also my understanding is that once a controller event is defined there is no way you can destroy it.
Now my questions are
1. Is my above understanding true ?
2. If true, then for a large project where i have about 60-70 views and many more event listener. should i take the approach of creating widget instead of the views because when you create a widget and destroy it, along with it all its listeners are also destroyed whereas in views the all the listeners in the controller will be active and consume resource .
3. can anyone provide me a way to measure the cost of maintaining a event listeners so that i can take an informed decisions