我编写了一个应用程序,它构建了一个由迭代过滤的用户故事网格。它似乎有效,并且没有错误,但故事列表不完整。一些迭代在网格中缺少一半的故事。所有故事都在同一个项目中。我究竟做错了什么?如果您对如何改进以下代码有任何建议,请告诉我。谢谢!
<!DOCTYPE html>
<html>
<head>
<title>StoriesByIteration</title>
<script type="text/javascript" src="/apps/2.0rc1/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function () {
Ext.define('CustomApp', {
extend: 'Rally.app.TimeboxScopedApp',
componentCls: 'app',
scopeType: 'iteration',
comboboxConfig: {
labelWidth: 100,
width: 300
},
addContent: function() {
this._makeStore();
},
onScopeChange: function() {
this._makeStore();
},
_makeStore: function(){
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
fetch: ['FormattedID','Name'],
autoLoad: true,
filters: [this.getContext().getTimeboxScope().getQueryFilter()],
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
_onDataLoaded: function(store, data){
var stories = [];
Ext.Array.each(data, function(story) {
var s = {
FormattedID: story.get('FormattedID'),
Name: story.get('Name'),
};
this._createGrid(stories);
stories.push(s);
}, this);
},
_createGrid: function(stories) {
var myStore = Ext.create('Rally.data.custom.Store', {
data: stories,
pageSize: 100,
});
if (!this.grid) {
this.grid = this.add({
xtype: 'rallygrid',
store: myStore,
columnCfgs: [
{
text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
},
{
text: 'Name', dataIndex: 'Name'
}
]
});
} else {
this.grid.reconfigure(myStore);
}
}
});
Rally.launchApp('CustomApp', {
name:"StoriesByIteration",
});
});
</script>
<style type="text/css">
.app { }
</style>
</head>
<body></body>
</html>