Threaded View
-
11 Oct 2012 4:34 AM #1
Answered: problem with requiring files
Answered: problem with requiring files
Hello
When I run my app I get warnings like
Here is how I've used the SearchListItem:Code:[WARN][Anonymous] [Ext.Loader] Synchronously loading 'NS.view.template.SearchListItem'; consider adding NS.view.template.SearchListItem' explicitly as a require of the corresponding class
The warning is only gone when I require the SearchListItem in app.jsCode:Ext.define('NS.view.ItemList', { extend: 'Ext.dataview.List', requires: [ 'NS.view.template.SearchListItem'], config: { itemTpl: Ext.create('NS.view.template.SearchListItem'), ...... } });
Any suggestions ?
Cheers
-
Best Answer Posted by mitchellsimoensCode in red is invalid, you should not create an instance on a config like that, only create instances within methods like (typing off top of my head):Code:
Ext.define('NS.view.ItemList', { extend: 'Ext.dataview.List', requires: [ 'NS.view.template.SearchListItem'], config: { itemTpl: Ext.create('NS.view.template.SearchListItem'), ...... } });
Code:Ext.define('NS.view.ItemList', { extend: 'Ext.dataview.List', requires: [ 'NS.view.template.SearchListItem'], config: { itemTpl: true, ...... }, applyItemTpl : function(tpl, oldTpl) { if (tpl === true) { tpl = Ext.create('NS.view.template.SearchListItem'); } return this.callParent([tpl, oldTpl]); } });


Reply With Quote