1. #1
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      0  

    Default Multiple Ext.Applications (Big Applications)

    Multiple Ext.Applications (Big Applications)


    Summary: By adding just a few lines of code,you get the ability to have multiple MVC folder structures in one application. Just put a controllers:[] array on any component and it will be loaded and registered. Vanilla ExtJS only lets you add controllers in the Ext.app.Application.


    EDIT (2012-11-25)
    Code changed to work with Ext 4.1.3. (Download from git mentioned below)

    EDIT (2012-06-07)
    Editing this post since i still get lots of question about this. The stuff i showed on SourceDevCon2012 is here:
    https://github.com/Fredric/ExtJS-Multiple-MVC

    Its all developed and tested using ExtJS 4.1.3

    Session Powerpoint is attached in the download section

    What it gives you is a way to use any panel (component) as a Ext.application by inserting the controllers array into them.

    Repository includes a full example of the Portal Demo. Just clone it down to examples folder.

    Installation requires one included js file and one controller then you are good to go. More details in Powerpoint and read me on git.

    For the eager, this is what you need
    Portal/MVCHelper.js <--- load in your index.html
    Code:
    <script type="text/javascript" src="MVCHelper.js"></script>

    Portal/app/controller/MVCLoader.js <---- place in your main app controller and mention it in app.js"

    Code:
    // Tell you main applications where to find your sub applications
    Ext.Loader.setPath('Stocks', '../Portlets/Stocks/app');
    Ext.Loader.setPath('Companies', '../Portlets/Companies/app');
    Ext.Loader.setPath('Company', '../Portlets/Company/app');
    
    
    Ext.application({
        name:'Portal',
        autoCreateViewport:true,
        controllers:['MVCLoader', 'MyOtherControllers']
    });
    Now you can make have a controllers array in any component config and make it load its own MVC structure using Ext.Loader.

    Code:
    Ext.define('Company.view.App', {
        extend:'Ext.Panel',
        alias:'widget.companyportlet',
        controllers:['Company.controller.Main']
    });

    Last edited by Fredric Berling; 25 Nov 2012 at 3:06 PM. Reason: New version

  2. #2
    Sencha Premium Member Springvar's Avatar
    Join Date
    Oct 2010
    Location
    Trondheim, Norway
    Posts
    4
    Vote Rating
    0
    Springvar is on a distinguished road

      0  

    Default Would love some quality feedback on this question.

    Would love some quality feedback on this question.


    We are currently facing the same challenge, and from what I've heard on SourceDevCon '11, so are others.

    I will definately do some small scale testing to see if Ext.Applications can easily coexist, and also if they can coexist within another Ext.Application. I guess autoCreateViewport needs to be false, but apart from that I have no inputs as of yet.

    If it turns out for some reason they can't coexist, perhaps the Sencha guys should look into this approach and see if there is a need for an ApplicationManager of some sorts...

  3. #3
    Sencha User
    Join Date
    Aug 2008
    Posts
    51
    Vote Rating
    7
    TonySteele is on a distinguished road

      0  

    Default Me To

    Me To


    I am just about to start a project which would be a portal/desktop like site. and want todo the same thing.
    An ideal example for me would be the desktop demo trhat was ported to ExtJs 4, ported to MVC, one master MVC app, managing MVC apps that are loaded dynamically.

    Come, Sencha, since (if you look at the forums) a quite a number of people are trying to do this or similar, lets have a statement about this or better still an example.

  4. #4
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Hey Fredric and @all,

    yeah, SourcCon rocked - and we all have the same energy from there

    It should be possible, it has to be verified in a testcase.

    You could define apps like

    Code:
    Ext.define('MyApp1', {
        extend: 'Ext.app.Application',
        alias: 'widget.myapp1',
        appPath: 'applications/app1',
        ...
    the problem i see is that there is no destroy on application base, and i have no idea what happens if you use an application in eg a window.
    But application is not a singleton, so more instances should live side by side. i would go for a small testcase using 2 very small application and one master app launching these. Please keep us informed.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  5. #5
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      0  

    Default


    Transforming the desktop app would be a great "proof of concept".

    Applications not being able to destroy would work fine in my specific case at this point. I would like to reuse the once started application. But of course there would be alot to gain if that existed.

    What we need is basically a application component. Maybe based on Panel or Container.
    Im starting to think "portlets" ..or "widglets", "applets" right?. (JSR168 flashback)

    Loader must be used at init to be able to load dependencies.

    Maybe what we also need is "packages" that loads with Ext.Loader, since the respective application is at this point is compiled.

    I will try what you pointed out Steffen.

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,789
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You know you only have 1 application right? What you then have is multiple views under it that can have their own controllers and models.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      0  

    Default Example

    Example


    @mitcheclsomoens. Not sure what you mean regarding one application. What i want is one directory structure per "application". This way they could be used a standalone applications and as a part of a portal if needed. Packaded individually.

    Here is one Example of how to do it. Its a very simple example, but loads the sub-application files as it needs them. Creates the second app Namespace on demand, side by side of the Main application(Portal)

    What you need to keep track of is to prefix your selectors so you hit your targeted application. I solved this by inventing the "AppName" config on the Panel/Window you use for wrapping your second application.

    Just paste into the Examples folder and give it a try and continue from there.
    Attached Files

  8. #8
    Sencha User
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    198
    Vote Rating
    1
    Nickname is on a distinguished road

      0  

    Wink


    Since two days I am rewriting the Desktop example to be MVC style. But my approach is a bit different than described in this thread.

    My virtual Desktop is "the application" and every Module in this application has its own controller. The desktop basic features like Startmenu, Taskbar and so on are controlled with one controller.

    Desktop App
    - Desktop Controller (responsible for taskbar, startmenu, quickstart, module management...)
    - Module1 Controller (like administration)
    - Module2 Controller (like settings)

    View, Stores, Models are seperated by subfolders/namespaces, so they are reusable by many Modules and dynamic loaded modules just need to register through the Application instance at the controller or requested by the app.
    Well, that is how it should be.

    If I understand the described approach correct, you want to have for every "module" its own application definition.
    Sharing stores (and maybe models) between applications could be a problem, because in views you refer to stores not with the complete store name, rather just with the non namespaced name.
    Example: "Ext.define('App1.store.Storename', {...})" is used in grid view just with "store: 'Storename'".
    RealWorld example: A UserStore is used in many modules, so in every App a UserStore needs to be defined.

    And what about the Desktop Management and Startmenu, Taskbar? You need one application that describes the desktop viewport and has something like a mixedcollection for all loaded or running applications(modules)

    The module = App way could be better for packaging on production deploy. But I am not sure, how to dynamic load applications. This can be possible if Ext.Loader.setPath() is adjusted every time a new App is requested

    ApplicationManager was there until beta3. Sencha removed it with beta3 because of the new MVC design.
    Maybe it is reusable with some hacks.

    I'm happy that this topic is now discussed by many users and looking forward for any testcases.
    Thought I am the only one, that uses the Desktop

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,789
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    @Nickname is doing what I suggested.

    You can keep your folder structure separated but still organized.

    app
    -controller
    --appOne (controller files go here)
    -model
    --appOne (model files go here)
    -store
    --appOne (store files go here)
    -view
    --appOne (view files go here)

    I know what you are going to say that this is repetitive as you want this:

    app
    -appOne
    --controller (controller files go here)
    --model (model files go here)
    --store (store files go here)
    --view (view files go here)

    If you can do multiple Applications then do it, I think it's a little overkill but should create that much overhead. Personally, my thinking goes into your one page has one Application instance with multiple "modules" that have their own MVC pattern but not there own Application instance.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  10. #10
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      0  

    Default


    I get your point @Nickname. That is one way to do it. I guess im thinking more in "packages" that can be handled by sencha command respectivly and with their own versions. This would of course need to be supported by the Loader. Not sure if that is possible right now.

    Glad we started to discuss this. My example is very simple. Its just to start a discussion in more detail.
    Our problem is basically that we need to separate the file structure to be able to have them maintained isolated and is only shown/used depending on user right.
    Under our portal we have hundreds of apps, wich need to be pulled out or in on demand, so i guess we are not facing the same problems in this matter.

Similar Threads

  1. Applications - how many?
    By westy in forum Ext: Discussion
    Replies: 0
    Last Post: 21 Feb 2011, 5:45 AM
  2. Building Big Applications
    By aramaki in forum Community Discussion
    Replies: 14
    Last Post: 29 Dec 2010, 3:55 PM
  3. Calling ext GWT applications from legacy applications
    By mathaj77 in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 14 Aug 2009, 4:15 AM
  4. Writting big applications
    By bkraut in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 21 Jul 2008, 12:32 AM
  5. Customize applications
    By JuanPalomo in forum Ext.nd for Notes/Domino
    Replies: 0
    Last Post: 2 Apr 2008, 11:51 PM

Thread Participants: 33

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi