对象 #<Object> 在应用程序 init 上没有方法'getStore'



我试图在应用程序的初始化视图中获得Store,但是控制台告诉我:Object #<Object> has no method 'getStore'

我想知道如何在这个序列中得到一个存储:

  1. 初始化应用
  2. 获取用户GPS位置
  3. 创建商店
  4. 显示带有商店的视图
<>之前Init: function () {this.callParent ();console.log(控制器初始化);},启动:function () {this.getApplicationSettings ();this.getApplicationRegionalisation ();Ext.getStore("appSettings")。setValue("地区"、"墨尔本");var store = Ext.create("APN.store.Locations");var geo = Ext.create('Ext.util ')地理位置,{自动更新:假的,听众:{Locationupdate:函数(geo) {var location = store.getClosestLocation(geo.getLatitude(), geo.getLongitude());Ext.getStore("appSettings")。setValue("区域",location.get("位置"));},locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {}}});之前

然后在视图中,我想调用这样的东西,如果我做了一个愚蠢的事情请纠正我:

<>之前要求:("APN.store.AppSettings"],…遗漏的东西//在条目中:项目:({itemId:"nav_home",id:"homeView",组:",标题:"家",布局:"vbox",slideButton: {selector: 'toolbar'};setingsbutton: {selector: 'toolbar'};项目:[{xtype:"articlelist",id:"latestNews",类别:"最新",feedUrlName://这里是虫子出没的地方!Ext.getStore("appSettings").getValue (Ext.getStore .getValue("appSettings")("区域"). get .home.url("菜单项"),}],},

无论您在哪里创建视图,您都可以在此之前创建store并显式地将store设置为视图,以便在初始化函数执行时它将获得this.config.store。要在应用程序初始化时获得GPS位置,您可以在Ext.application的Launch功能中获得位置,甚至在创建商店和视图之前。如果你想在store数据加载后才创建view,你应该在store的load回调中创建view。

我希望这是你所寻找的,如果不是,请添加一些代码到你的问题,以便我们可以评论的细节

最新更新