I have a grid associated with the repository with autoLoad: true . The problem is that the repository is loaded when the application starts, even if the view is created only later when accessed through the menu.
I reference the repository in Application.js and in the view, but I do not explicitly set the repository or the view.
I do not know how to ensure that the repository is loaded only when it is necessary for the presentation.
- If I set
autoLoad: true , the repository will load when the application starts. - If I set
autoLoad: false , the repository does not load at all.
I know this is pretty simple, but I'm stuck so far.
Here is all the appropriate code for reference:
app / store / Owners.js
Ext.define('Mb.store.Owners', { extend: 'Ext.data.Store', model: 'Mb.model.Owner', autoLoad: true, proxy: { ... });
application.js
Ext.define('Mb.Application', { name: 'Mb', extend: 'Ext.app.Application', models: [ 'Owner' ], stores: [ 'Owners' ], ...
app / view / Owners.js
Ext.define('Mb.view.winbiz.Owners', { extend: 'Ext.grid.Panel', alias: 'widget.test-gridPanel', store: 'winbiz.Owners', columns: [{ ...
In the controller, a view is created:
Ext.define('Mb.controller.Winbiz', { extend: 'Ext.app.Controller', views: [ 'Owners' ], init: function(){ this.control({ 'menu #test': {click: this.onMenuTest}, }) }, onMenuTest: function(){ this.getController('Main').addToMainTab('test-gridPanel'); },