Question

I am using rally app builder, and App-debug.html to run the app externally. I defined a data store in a separate js file. How can I make App.js access the store? I am getting an error that store is not defined.

Était-ce utile?

La solution

Here is an example. Each file has a class defined with Ext.define().

App.js:

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    items:{ html:'<a href="https://help.rallydev.com/apps/2.0rc2/doc/">App SDK 2.0rc2 Docs</a>'},
    launch: function() {
    var s = Ext.create('MyStore');
    var myStore = s._createStore();
    console.log(myStore);
    }
});

MyStore.js:

Ext.define('MyStore', {
    _createStore: function(){
        return Ext.create('Rally.data.WsapiDataStore', {
                model: 'User Story',
                fetch: ['FormattedID','Name'],
                pageSize: 100,
                autoLoad: true,
                context:{
                    project: '/project/1791267822',
                }
        });
    }
});

config.json:

{
   "name": "MyApp",
   "className": "CustomApp",
   "server": "https://rally1.rallydev.com",
   "sdk": "2.0rc2",
   "javascript": [
      "App.js",
      "MyStore.js"
   ],
   "css": [
      "app.css"
   ]
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top