1. #1
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    70
    Vote Rating
    4
    zwikske is on a distinguished road

      0  

    Default How to deal with stores in another namespace

    How to deal with stores in another namespace


    Hello all,

    In our environment we're building an application that makes use of generic parts that can also be used in other apps. This varies from components to stores. These generic parts have been put in a separate namespace and are configured in the loader part for debugging and sencha.cfg for building using Sencha CMD.
    The loader part:
    Code:
    //<debug>
    Ext.Loader.setPath(
    {
        'zwik': '../shared/src',
        'Ext': '../touch/src',
        'Cm': 'app'
    });
    // </debug>
    sencha.cfg
    Code:
    app.name=Cm
    app.framework=touch
    app.shared = ${app.dir}/../shared/
    app.classpath=${app.dir}/app.js,${app.dir}/app,${app.shared}
    The problem we're having is that we are not able to create a working production build that makes use of shared stores in another namespace. During the actual build there are no errors and also no warnings when we compile with the shared/generic store. Though, when we launch the application that makes use of one of these shared stores we get a HTTP 404 error for the shared store we're using.

    When I investigate the production app.js generated by Sencha CMD I can find the shared/generic store in there. So why is the application looking for it somewhere else as well? .

    My question is, how should we deal with this? Is this even possible? I can get rid of the 404's by removing the stores from the store configuration in app.js but then the store events stop working. If I then put the stores in the requires section of the class that makes use of the store the events don't work.

    Other shared/generic items in other namespaces, such as components, work fine and don't cause any problems at all. Also when we're coding the build works fine. It's only the build part that seems to go wrong.

    We're using ST2.1 with Sencha CMD 3.0.0.250.

    Thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,812
    Vote Rating
    834
    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


    Where are you requiring the store?
    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.

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    70
    Vote Rating
    4
    zwikske is on a distinguished road

      0  

    Default


    I'm requiring the store in the app.js. I've also tried requiring in the class where we actually need the store but that didn't seem to help either

  4. #4
    dcordes
    Guest

    Default Same problem here

    Same problem here


    I'm dealing with the same problem. Isn't it possible to define more than one path for different sub-apps? Something like this:

    Code:
    Ext.Loader.setPath({
        Ext: 'touch/src',
        FirstApp: 'app',
        SecondApp: 'external/SecondApp/app'
    });
    It seems as if sencha cmd is just looking at the name attribute inside app.json (which is FirstApp in my case). If not packed, this way of dealing with different apps put together works absolutely great!
    Even the build process itself is completely error- and notice-free. Only when starting the app (built, packaged and minified) the paths to the SecondApp's files are not correct.

    Let's say we have this cotroller: SecondApp.controller.ExampleController (actual path: [rootDirectory]/external/SecondApp/app/controller/ExampleController), then it is tried to be accessed by FirstApp.controller.SecondApp.controller.ExampleController. (actual path: [rootDirectory]/app/controller/SecondApp/controller/ExampleController)
    In the app.js I defined the controller like this: SecondApp.controller.ExampleController. Obviously SecondApp is not interpreted correctly as a newly defined path, but as a suffix to FirstApp.controller.

    So what's the problem with the build process here? How can we fix this?

  5. #5

    Join Date
    May 2012
    Location
    Linz, AT
    Posts
    23
    Vote Rating
    2
    eeckhev is on a distinguished road

      0  

    Default


    Hi,

    did you ever find the solution to that problem?

  6. #6
    Sencha Premium Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    70
    Vote Rating
    4
    zwikske is on a distinguished road

      0  

    Default


    Hello,I'm not sure if it's a solution or a workaround. Anyway what we currently do is set the path to the other namespace using the following construction:
    Code:
    Ext.Loader.setPath({    'otherApp': 'path/to/other/app'});
    In the controller of where we want to use the other store we add the following to the constructor:
    Code:
    constructor: function()    {        Ext.create('otherApp.store.StoreName',        {            storeId: 'yourStoreIdHerePlease'        });                this.callParent(arguments);    },
    This is working for us at the moment. At the moment we had the above problem we were using ST2.1. Currently we upgraded to ST2.3.1 with CMD 4.0.2.67 and it's still working. Hope this helps you .

  7. #7

    Join Date
    May 2012
    Location
    Linz, AT
    Posts
    23
    Vote Rating
    2
    eeckhev is on a distinguished road

      0  

    Default


    Thanks,

    this has helped me very much.

    Now it's working.

    It would be really interesting how we can register an external store within the app.

    Thanks again!