View Full Version : More than one controller class...

25 Nov 2011, 2:29 AM

I'm working on kind a big buisness project which i'm developing in Sencha Touch. Now I'm porting project from ST1.0.0. to ST PR2 and I have couple of thoughts..

I want to have a more than one class controllers. For example, I want to have a controller to each view. I tried to write it and ok - i cut my code into pieces and packed it into controllers. I declared that classes in my app.js file and everything works fine... except a fact that it starts to work impossible SLOW. I need to wait 5-10 seconds to render a one view. I don't know where the problem is or it's mayby a bad programming scenario to cut code into multiple controllers? Having everything in one file (e.g. controller/main.js), which have a over 10000 lines of code is not a good option to work with.

Could someone tell me what am I doing wrong? Is it a bug or smth that it is working so slow now? Or mayby it is normal that a initialization of every controller make my application to 'think'?

Thanks for the answers.

25 Nov 2011, 8:14 AM
Are you loading sencha-touch.js, sencha-touch-all.js, or a built MVC app? If you are using sencha-touch.js then the reason is because it has to load each class needed at startup. This will only happen during development as in production you should use the SDK Tools to build your app and it should have all the needed classes (application and ST2 classes that aren't included in sencha-touch.js)

28 Nov 2011, 12:38 AM
I'm using sencha-touch-all.js. I have never tried building app using SDK Tools, but I would try it after PR3 where I want to test my app. Now I get back to have all control code in one controller. It's not beautifull in code, but working like a charm.