Results 1 to 5 of 5

Thread: How to Manage the MVC in big appliation?

  1. #1
    Sencha User
    Join Date
    Jan 2011
    Location
    banglore
    Posts
    12

    Default How to Manage the MVC in big appliation?

    Hi,
    I am developing the erp in ext js 4(mvc architecture), in that i am using various forms,grids,trees and windows,i had finished one window in first module is perfectly working. But my doubt is how to manage the various modules windows in mvc architecture ?

  2. #2
    Sencha User
    Join Date
    Sep 2010
    Posts
    58

    Default

    Same question here. I have a big app which I want to migrate its GUI to use ExtJS 4. I'm reading the MVC guide. I like it, but it seems to be a directory structure for small apps:

    Code:
    /app
      /controller
      /model
      /view
      /store
    I have 30-40 modules in my app so I couldn't have all the views of each module on the view directory. I'd like this instead:

    Code:
    /app
      /modules
        /users
          /controller
          /model
          /view
          /store
        /other_module
          /controller
          /model
          /view
          /store
    Is it possible to adapt the MVC implementation to use such a structure?


    Thanks.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    2

    Default

    Same here, but maybe a little more precise.

    I have no idea where should I create my stores. I'm a noob to ExtJS, but I have some dev experience and I'd say that the controllers are the best place for this.

    Please see the paging little demo here:
    http://dev.sencha.com/deploy/ext-4.0...Ext.grid.Panel

    So they created the store in the view. Or just simplified the demo. Is it the best practice?

    BTW: There is this recommended controller/model/store/view structure in the docs. But it is hardly ever used in the examples. So in a real life I can't just copy/paste the example code. It won't work because of reasons like the store creation above. Do you agree?

    Perhaps someone could create a sample app using the structure and some standard components, a grid with paging, a chart, two or three different layouts.

  4. #4
    Sencha User
    Join Date
    Sep 2010
    Posts
    58

    Default

    I've fixed my previous post. I didn't notice that I didn't use the CODE tags to show the directory structures.

    About your question, in my opinion, the store should be in its own file if you're gonna use it with other components (which is true the 90% of the cases).

    I made a few apps with ExtJS in the past, just for learning purposes. And I had used a structure similar to the described in my previous post. The difference is that I didn't use a MVC pattern. I had this structure:

    Code:
    /app
      /module1
        /Data
        /Form
        /Grid
        /Window
        /Etc
      /module2
        /Data
        /Form
        /Grid
        /Window
        /Etc
    The thing now is that with ExtJS 4 we have a Loader, a new Application class and a MVC pattern implementation, which seems to require the structure told in the docs. Now, I'd like to know if this structure is something that is customizable or not. If it's not, then I'll use my own structure again, but in this case, what would I lose, besides the standard proposed by ExtJS in this matter? does the Application class require this dir structure for something? I see, for example, this snippet on the MVC docs:

    Code:
    Ext.application({
        ...
    
        controllers: [
            'Users'
        ],
    
        ...
    });
    So, if I don't use the "controller" directory right inside the "app" directory (this one CAN be changed as far as I saw), how could the Application class know where is the "Users" controller?

    These are the kind of questions that I was looking for in the docs before start to give ExtJS 4 a try.


    Thanks in advance

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    2

    Default

    About your question, in my opinion, the store should be in its own file if you're gonna use it with other components (which is true the 90% of the cases).
    I should define them in their own file, no doubt. But create them there too?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •