PDA

View Full Version : ExtJS 4 + Sencha Touch



sg707
28 Jan 2011, 2:34 PM
Hi Guys,

In a about a month after ExtJS4 comes out, I will "again" strike for the gold by creating a new Web Application. At that time, I may also consider using Sencha Touch for mobile access as well.

So!! The question comes to mind on how to modularize the code so that Sencha Touch and ExtJS 4 can be easily be reusable and maintained.

I'm sure writing 2 complete separate code base would be the "worst" case scenario. The part I'm most puzzled is the ExtJS 4 MVC capability. If ExtJS 4 stays true to MVC philosophy then "Control" and "Model" should be exactly same for Sencha Touch and ExtJS 4. The only extra part would ExtJS 4 View and Sencha Touch View. Am I wrong? I guess to summarize my question would be

Can I use the same MVC API for ExtJS 4 and Sencha Touch?

If not, how would you architect a web application that uses both ExtJS 4 and Sencha Touch?

1 Feb 2011, 4:55 AM
The MVC for Ext 4 will most likely be improved upon.

That said, the most that can be reused at this point is models and possibly controllers. Views will be different.

Condor
1 Feb 2011, 5:08 AM
Controllers are only reusable if you make them independent of the view.

This was one of the things that bothered me about the quick MVC example shown at the conference. The controller contained event handlers from components in the view. These events should be generalized and not be directly fired from the components.

1 Feb 2011, 5:13 AM
Controllers are only reusable if you make them independent of the view.

This was one of the things that bothered me about the quick MVC example shown at the conference. The controller contained event handlers from components in the view. These events should be generalized and not be directly fired from the components.

Agreed. The only problem with that is you add overhead to dispatch to a controller for every event you want fired, adding more to the method stack.

sg707
2 Feb 2011, 9:58 AM
Thanks for the response!

I really can't wait to see the MVC stuff..wasn't able to find that demo through the conference videos. I'm not too surprise that Controller has direct tied to specific View classes at this point. It's probably missing the "configuration" layer which makes the Controller and View layer independent... ah well.. Maybe later version will improve upon on this.

agamil
4 Oct 2013, 6:02 AM
I haven't really used Sencha much at all yet except for playing around a little with the trial of architect and trying Sencha Touch.

But what if you configure the controlQuery of the controller event so that it refers to something of the exact same name of the component in the other view type?

So, for example, we have one controller for both ExtJs and Sencha Touch that has ControllerAction with a controlQuery of "myFormPanel button" and then in the two views, we make sure that the view and button names or whatever are the same.