View Full Version : Why i should declare views inside a controller?

American horizon
11 May 2016, 2:43 AM
Suppose that i've to manage a view after an event occurs. Actually i can simple access to view throught Ext.getCmp(id) and i've not linked the view to the controller.

But according to the example of the site, i should declare views in the config of controller.

Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views: [
init: .
Why it's necessary?

Tim Toady
17 May 2016, 5:22 AM
It's not necessary(unless you don't do it any other way) and I don't personally use it. It is just another way of making sure it gets the file. I typically require my views on their parents since that makes more sense to me.