mmmilo
3 Oct 2012, 6:36 AM
Hi,
Is there a way to get the current View in a Controller *without* setting a reference for it?
Ext.define('myapp.controller.ListingController', {
extend: 'myapp.CommonController',
config: {
views: ['ListingView'],
refs: {
main: 'ListingView',
},
}
},
launch: function() {
var bar = this.getMain().up('navigationview').getNavigationBar();
bar.hide();
},
});
In my example I have a View wrapped by a NavigationView. I want to hide the titlebar in the NavigationView. This code works fine.
However if I want to use it elsewhere, I need to add a new ref, and change it accordingly, since getMain() is the important part here. That kind of defeats the purpose of DRY principles.
What I'd *like* to do is to be able to create a generic hideTitleBar() function to CommonController (which just extends Ext.app.Controller), so I could just put:
launch: function() {
this.hideTitleBar();
},
Is there something I'm missing?
Thanks!
Is there a way to get the current View in a Controller *without* setting a reference for it?
Ext.define('myapp.controller.ListingController', {
extend: 'myapp.CommonController',
config: {
views: ['ListingView'],
refs: {
main: 'ListingView',
},
}
},
launch: function() {
var bar = this.getMain().up('navigationview').getNavigationBar();
bar.hide();
},
});
In my example I have a View wrapped by a NavigationView. I want to hide the titlebar in the NavigationView. This code works fine.
However if I want to use it elsewhere, I need to add a new ref, and change it accordingly, since getMain() is the important part here. That kind of defeats the purpose of DRY principles.
What I'd *like* to do is to be able to create a generic hideTitleBar() function to CommonController (which just extends Ext.app.Controller), so I could just put:
launch: function() {
this.hideTitleBar();
},
Is there something I'm missing?
Thanks!