6
votes

Ok, I have been thinking of developing a web application using the play framework as my back-end service and sencha for my front end stuff.

Now I have been also looking into sencha touch and phonegap, which can help me make a native android application. So the problem here is how do i render data to two different devices. One is a touch device and other opens in a proper desktop browser.

Should I detect from which device the request has been made and then load the appropriate controller or what ? I am really confused right now ! I am very new to the web and mobile application scene, so please if someone can explain to me how to proceed would be a great help ! Thank you.

2

2 Answers

4
votes

I use Sencha too, not Touch but Ext Js. What I have done is the following:

Play! Server contains my logic and provides me the Restful URLs:

POST   /user/create          AccountController.createUser
GET    /user/userid          AccountController.getUser

With Sencha I have defined a Store that retrieves JSON data from a specific URL, that URL point to my Play! urls.

In my method in Play I retrieve an Model from my database and just return the JSON that Sencha will parse/read like:

Query userQry = JPA.em().createQuery("select * from Account");
List<Article> accounts= userQry .getResultList();
renderJSON(accounts);

Cheers

0
votes

Sencha Touch is not suited for desktop use. You should build different app for desktop using Ext.JS. But if you still want to go with Sencha Touch here is guide how to have different views for different devices. http://docs.sencha.com/touch/2-0/#!/guide/profiles