View Full Version : How to deal with stores in another namespace

29 Nov 2012, 5:19 AM
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:

'zwik': '../shared/src',
'Ext': '../touch/src',
'Cm': 'app'
// </debug>


app.shared = ${app.dir}/../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


1 Dec 2012, 7:18 AM
Where are you requiring the store?

4 Dec 2012, 3:39 AM
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

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

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?

1 Feb 2014, 2:22 AM

did you ever find the solution to that problem?

3 Feb 2014, 12:09 AM
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:
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:
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 and it's still working. Hope this helps you :) .

3 Feb 2014, 2:22 AM

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!