The problem with your code is the use of the 'Workspace' model (see the
bolded line in the question code excerpt).
Refer to this
article to learn the limitation of the 'Workspace' model. Instead you should use the 'Subscription' model, then create a store out of its Workspaces collection.
Here is the full SDK code:
//API Docs: https://help.rallydev.com/apps/2.1/doc/
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
app: null,
_whoIsThis: function(aFunctionaName, anObject) {
console.log('Who Is This: Called by: ', aFunctionaName, ': This = ' , anObject);
},
launch: function() {
console.log('Worspaces - Start');
// app = this;
// this._whoIsThis('launch', this);
this._loadData();
},
// Get data from Rally
_loadData: function() {
Ext.create('Rally.data.wsapi.Store', {
model: 'Subscription', fetch: ['Name', 'Workspaces'],
pageSize: 500,
autoLoad: true,
listeners: {
load: function(store, records) {
var subscription = records[0];
console.log('subscription.Name = ' + subscription.get('Name'));
var WorkspacesCollection = subscription.get('Workspaces');
console.log('WorkspacesCollection = ' + WorkspacesCollection);
var WorkspaceCount = WorkspacesCollection.Count;
console.log('WorkspaceCount = ' + WorkspaceCount);
var collectionStore = subscription.getCollection('Workspaces', {
fetch: ['Name', 'State'],
// autoLoad: true
});
this._loadGrid(collectionStore);
// .load({
// callback: function(records, operation, success) {
// Ext.Array.each(records, function(workspace) {
// console.log(workspace.get('Name') + ': ' + workspace.get('State'));
// });
// app._loadGrid(records);
// }
// });
},
scope: this
}
});
},
_loadGrid: function(aStore) {
this.add({
xtype: 'rallygrid',
store: aStore,
columnCfgs: ['Name', 'State'],
enableEditing: false
});
}
});