PDA

View Full Version : sencha-touch instead of sencha-touch-all.js



michele.vigano
20 Sep 2013, 8:14 AM
Hi,
i'm not using the MVC pattern but a simple html page that loads css/js and other stuff. The principal js contains only the onReady that calls all the necessary functions. I have a lot of pages and i would like to minimize loading times.


Is it possible to use sencha-touch.js instead of sencha-touch-all.js.
Actually with sencha-touch-all.js everything work well. If i try to use sencha-touch.js i get some errors like this:


Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR:
......../HTML/lib/touch/src/Evented.js';
the file is either being loaded from a different domain or from the local file system whereby cross origin requests are not allowed due to security reasons. Use asynchronous loading with Ext.require instead.


I read that i should using Sencha SDK tools and create my own build to solve the problem.
Is it right?
How can i do it using Sencha Touch 2.2.1 ?


The ultimate goal is to create a common build to integrate all the pages and then create a specific build for each page

Thanks,
M

Kurt001
23 Sep 2013, 2:24 AM
Sencha Touch All contains all elements like the loader.
Sencha Touch only contains very basic items.

Lets say you want to use Ext.dataview.List then you have to add this to your html file as a script. List requires ... 'Ext.data.Store', 'Ext.dataview.IndexBar', 'Ext.dataview.ListItemHeader', 'Ext.dataview.component.ListItem', 'Ext.dataview.component.SimpleListItem', 'Ext.util.PositionMap'... so you need to load these files too. If these files require other files, then .... you see what I am saying?

michele.vigano
25 Sep 2013, 2:15 AM
Is there a way to create a single js file to be included in the html through the use of sdk tools? In this case what should I do?

Thanks,
M.

Kurt001
25 Sep 2013, 5:48 AM
goto root in cmd line and type

sencha app build package
Sencha SDK will create a new folder in root named 'build'

If you added Ext.List to requires in the app.js or whereever you are using the list, it should work.

michele.vigano
26 Sep 2013, 1:45 AM
I'm using sencha sdk tools not the cmd.
I can create a js file (all-classes.js app-all.js) but then if I include it into the index.html i still get error
Any advice?

Kurt001
26 Sep 2013, 2:21 AM
I wrote it above. You have to add to the requires section in the app.js
'Evented'