1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    Carlos Nunes is on a distinguished road

      0  

    Default Unanswered: Extjs MVC with .Net MVC

    Unanswered: Extjs MVC with .Net MVC


    Hi all, I'm currently implementing a portal using .net mvc and extjs(no mvc), but I would like to start organizing my extjs code with mvc too. So far I have followed your tutorial and I could implement a store getting data from a .net controller and show the grid in the view.

    But my doubt is that in my application I have a lot of .net mvc views and I'm not sure how to organize extjs code for all of them. Should I have an app.js for each view? or there is a better way to do it and maybe reusing code.

    Thanks in advance,
    Carlos Nunes

  2. #2
    Sencha User Fire-Dragon-DoL's Avatar
    Join Date
    Dec 2011
    Posts
    141
    Vote Rating
    1
    Answers
    9
    Fire-Dragon-DoL is on a distinguished road

      0  

    Default


    Quote Originally Posted by Carlos Nunes View Post
    Hi all, I'm currently implementing a portal using .net mvc and extjs(no mvc), but I would like to start organizing my extjs code with mvc too. So far I have followed your tutorial and I could implement a store getting data from a .net controller and show the grid in the view.

    But my doubt is that in my application I have a lot of .net mvc views and I'm not sure how to organize extjs code for all of them. Should I have an app.js for each view? or there is a better way to do it and maybe reusing code.

    Thanks in advance,
    Carlos Nunes
    No I don't think app.js should be duplicated.
    I think you should create, eventually, multiple Viewport.js (and so you have to avoid autoload it).

    Possibly, you should generate a part of javascript code in this way:
    // scss coffee

    Code:
    Ext.application({
      name: 'MyApp',
    
      launch: <generate this function with .net>
    });
    So you can run the correct Viewport.

    A different approach could be: have only one viewport which will build differently, based upon some values that you generate through .net.

    This could be the best option (the second one) because you'll stick with ExtJS app structure.
    However, all these solutions involve generating javascript code dinamically, which is something that I don't like and feels really incorrect.

    Maybe you can create Viewport.js so that will be dinamically generated by including another file, choosing it from your views which are written in plain javascript. This could be a good idea, so you'll have something like this:

    Viewport.js.cs
    ->Include <myview_based_on_link.js>

    So you can keep .net mvc directory structure too, even for views

    Notice that I don't use .net MVC, but I did something similar with Ruby on Rails. Don't know if it's a good idea, but looks interesting for me.

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Posts
    2
    Vote Rating
    0
    Carlos Nunes is on a distinguished road

      0  

    Default


    @Fire-Dragon-DoL thanks for the answer.

    In my project I'm using Container instead of Viewport because I want the Extjs components inside a div in HTML template page. And if I use one application with a container for each View (.net View) is there any problem (performance or other kind of it)?

    Thanks,
    Carlos Nunes



Thread Participants: 1

Tags for this Thread