View Full Version : difference
mohaskuar
3 Sep 2012, 1:16 AM
what is the differnce b/n these two when used on controllers
var searchGridWin= this.getUserSearchGridView();
this.searchGridWin = Ext.widget('searchGrid'); the first retuns a function and the later returns an object....i want to use the first way to do something like
searchGridWin.show(); rather this.searchGridWin.show()//when using the second method;
tvanzoelen
3 Sep 2012, 1:23 AM
The first returns the class if it was registered in the views section of the controller. then that function is available.
Ext.widget will allways return an instance of the specific class, if it is loaded within the scripts.
So with the first you must first create an instance with it.
try
var searchGridWin= new this.getUserSearchGridView()
searchGridWin.show();
mohaskuar
3 Sep 2012, 1:29 AM
controller
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views:[
'user.List','user.Edit','user.West','user.Tabview','user.ReportTree','user.SearchGrid',
],
stores:[
'Users','Policies','SearchGrids',
],................. the view is registered. but the problem is when i tried to make the view show up
var searchGridWin= new this.getUserSearchGridView() searchGridWin.show();is not working ....on firebug searchGridWin is an empty function
tvanzoelen
3 Sep 2012, 1:33 AM
I think it reurns the class.
then it should be this.
var searchGridWin= this.getUserSearchGridView()
new searchGridWin({}).show();
mohaskuar
3 Sep 2012, 1:33 AM
controller
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
views:[
'user.List','user.Edit','user.West','user.Tabview','user.ReportTree','user.SearchGrid',
],
stores:[
'Users','Policies','SearchGrids',
],................. the view is registered. but the problem is when i tried to make the view show up
var searchGridWin= new this.getUserSearchGridView() ;is not working ....on firebug searchGridWin is an empty function
tvanzoelen
3 Sep 2012, 1:38 AM
No, See my other post. I think its a class.
var searchGridWin= this.getUserSearchGridView()
new searchGridWin({}).show();
And see this part http://docs.sencha.com/ext-js/4-1/#!/api/Ext.app.Controller method getView
In that case, below should also work.
var searchGridWin= this.getUserSearchGridView().create();
searchGridWin().show();
Its strange because for stores it seems an innstance is returned.
mohaskuar
3 Sep 2012, 4:31 AM
this works
var searchGridWin= this.getUserSearchGridView();
new searchGridWin({}).show();
i have checked out that for the store indeed it returns an instance,10ks.tranzoelen
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.