1. #1
    Ext User Dave.Sanders's Avatar
    Join Date
    Mar 2008
    Posts
    131
    Vote Rating
    0
    Dave.Sanders is on a distinguished road

      0  

    Default Ext.Direct and MVC

    Ext.Direct and MVC


    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.

  2. #2
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Boca Raton, FL
    Posts
    94
    Vote Rating
    1
    jimmifett is on a distinguished road

      0  

    Default


    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.

  3. #3
    Ext JS Premium Member
    Join Date
    Mar 2009
    Posts
    17
    Vote Rating
    2
    schiffm is on a distinguished road

      0  

    Default


    Quote Originally Posted by Dave.Sanders View Post
    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 (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.

  4. #4
    Ext JS Premium Member dancablam's Avatar
    Join Date
    Apr 2008
    Location
    Dallas, TX
    Posts
    134
    Vote Rating
    0
    dancablam is on a distinguished road

      0  

    Default


    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

  5. #5
    Sencha User
    Join Date
    Jan 2008
    Location
    Toronto, Canada
    Posts
    480
    Vote Rating
    4
    elishnevsky is on a distinguished road

      0  

    Default


    You can try my implementation: http://extjs.com/forum/showthread.php?t=72245