PDA

View Full Version : Ext.Loader to production



bstras21
28 Nov 2011, 7:59 AM
My understanding is that when I want to go to production I use:



Ext.Loader.setConfig({
enabled: false
});




However I get this error:
Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically.

Here is my HTML, what am I doing wrong:


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title id="page-title">testApp</title>

<link rel="stylesheet" type="text/css" href="js_lib/sencha_touch/resources/css/sencha-touch.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

<script type="text/javascript" src="js_lib/sencha_touch/sencha-touch-all.js"></script>
<script type="text/javascript" src="app/app.js"></script>
</head>
<body>

</body>
</html>

mitchellsimoens
28 Nov 2011, 8:11 AM
In production, Ext.Loader shouldn't be used. Throughout developing it should be.

bstras21
28 Nov 2011, 8:17 AM
I even tried taking it out completely and I get this error:

Uncaught Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required classes: testApp.controller.LoginController, testApp.controller.LanguageController

Here is my app.js


/*Ext.Loader.setConfig({
enabled: true
});

Ext.Loader.setPath('testApp','app');

Ext.require([
'Ext.XTemplate',
'Ext.Panel',
'Ext.Button',
'Ext.List',
'Ext.Map',
'Ext.data.Store'
]);*/
Ext.application({
name: 'testApp',
controllers: ['testApp.controller.LoginController', 'testApp.controller.LanguageController'],
launch: function() {
var viewport = Ext.create('Ext.Panel', {
fullscreen: true,
id:'mainViewport',
layout: 'card',
activeItem: 0,
items: [
{xtype: 'LoginForm'},
{xtype: 'LanguageList'}
],

});


}

});


If I uncomment all the Ext.Loader stuff it works fine.

jratcliff
28 Nov 2011, 8:19 AM
If ST 2.x is like ExtJS 4.x then you have to download the SDK Tools and use that to do a custom build. You then replace your sencha-touch-all.js and app.js references with an app-all.js file that gets built.

mitchellsimoens
28 Nov 2011, 8:23 AM
So you have disabled Loader and you are getting the error that dependancies are not able to be resolved. This means that you have not setup your requires/uses properties on your application files correctly and then used SDK Tools to create a custom build.

bstras21
28 Nov 2011, 8:35 AM
Can you please provide an example on where to use the requires/uses properties? I am looking at the docs right now in Application and Controllers but do not see these properties?

Thank you for all the help!

mitchellsimoens
28 Nov 2011, 8:38 AM
search for requires in the kitchensink example... Kitchensink.view.Audio has one... Kitchensink.view.Carousel has one...