PDA

View Full Version : Newbie questions about Sencha Touch



bagusflyer
22 Dec 2011, 1:02 AM
I'm new to Sencha Touch. I'm going to develop a web app in Sencha Touch. Here is the short description:

- My application will retrieve data from MySql database and also need to save data to database.
- There are about 10 different pages.

My questions is:

- Do I have to use Json to get data from my database? I have now way to integrate Sencha Touch with php to get data directly from php, right?
- Do I have to create different pages or just different panels? If I create different pages, is it possible to use transition animation to transit from one page to another one?

Thanks for advance.

mitchellsimoens
22 Dec 2011, 7:37 AM
So in your Ext.data.Store, when it loads data, it loads it from a PHP script. You can use JSON or XML as a transfer between PHP and Sencha Touch with JSON being the very much preferred transport means. PHP has a native way to endcode/decode JSON with json_encode(array(...)) and json_decode('...').

Sencha Touch is best used as a single page application. You cannot do transitions between different pages and you would have to redownload the JS and CSS files for each page which would not be a good user experience. So adding and removing panels with transitions is the best practice.

bagusflyer
22 Dec 2011, 4:24 PM
OK, I see. Then I can use multiple views in different js files. But here comes another question is there a way to load js file dynamically? For example, I have 10 views in my application, I'll write 10 js files for them, I only load views according to certain condition, some views are even not needed at all if the user won't select them. If I load all the views it's a waste of bandwidth.

digeridoopoo
24 Dec 2011, 8:07 AM
Yes version 2 of Sencha Touch is much better at loading these view dynamically.....it is possible in v1 although you would have to follow a tutorial such as this one:

http://www.onlinesolutionsdevelopment.com/blog/web-development/javascript/loading-sencha-touch-controllers-and-view-files-dynamically/

:-)

bagusflyer
24 Dec 2011, 2:55 PM
Great articles. Thanks