PDA

View Full Version : Ext.Direct and MVC



Dave.Sanders
4 Jun 2009, 8:31 AM
I'm just starting to play with both, in a .NET MVC scenario, and I'm trying to reconcile it in my head. Ext.Direct seems to be mutually exclusive of MVC because the routing is happening at one place, as opposed to the MVC framework handling the routing. Am I wrong?

I'm trying to wrap my head around whether you could have a MVC friendly Ext.Direct? One that translates the clientside object model functions to a server side URL with the understanding that it will receive JSON back.

I'll have to dig some more into the code to grok it, but was curious if anyone else had an opinion yet.

jimmifett
4 Jun 2009, 10:44 AM
If by MVC, you mean Model/View/Controller, then you have to realize that in the ajax world, MVC is a bit different and areas overlap.

First you have the browser, which is your view (xhtml, css, javascript related to display of data).
Depending on how you code, you're Model and controller will be both on the server and in the browser via javascript.

You will have model and controller on the server, representing your core business rules, validation, and data. Then you will have ajax as a modeled data transport layer. You will need to model the data being sent back and forth from the browser's javascript. Finally you'll need a controller sitting in the browser (your app logic) that handles the client side business and flow logic as well as requesting modeled data from the server via the ajax.

schiffm
8 Jun 2009, 6:13 AM
I'm just starting to play with both, in a .NET MVC scenario, and I'm trying to reconcile it in my head. Ext.Direct seems to be mutually exclusive of MVC because the routing is happening at one place, as opposed to the MVC framework handling the routing. Am I wrong?

I'm trying to wrap my head around whether you could have a MVC friendly Ext.Direct? One that translates the clientside object model functions to a server side URL with the understanding that it will receive JSON back.

I'll have to dig some more into the code to grok it, but was curious if anyone else had an opinion yet.

We're also looking for answers to this question. We have an application that uses ExtJS 2.1 and the ASP.NET MVC Framework (http://www.asp.net/mvc/) (where MVC does stand for Model-View-Controller, but in this case we're talking about a specific framework).

We're getting ready to start writing a major new version of our app. We are shooting for ExtJS 3.0, but we want to know if using Direct will mean forgetting about the MVC framework, or if anybody has an example of how they would work together -- or if it even makes sense.

dancablam
8 Jun 2009, 6:53 AM
I created the router for the symfony MVC framework by extending the controller. The controller then intercepts the Ext Direct request and handles the routing. This allows you to keep any existing views intact and also output the response into JSON format transparently for Ext requests. I can't speek for other MVC frameworks but with symfony you still have virtually all of its powerful features at your disposal while supporting Ext Direct. I highly recommend using a solid MVC framework with Ext Direct.

Cheers,
Dan

elishnevsky
24 Jun 2009, 5:57 AM
You can try my implementation: http://extjs.com/forum/showthread.php?t=72245