首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >迭代应用程序的AppSDK2故事不显示迭代中的所有故事

迭代应用程序的AppSDK2故事不显示迭代中的所有故事
EN

Stack Overflow用户
提问于 2013-07-18 06:57:41
回答 1查看 103关注 0票数 0

我写了一个应用程序,它构建了一个按迭代过滤的用户故事网格。它似乎起作用了,没有错误,但故事列表是不完整的。一些迭代中有一半的故事在网格中丢失。所有的故事都在同一个项目中。我做错了什么?如果你对如何改进下面的代码有什么建议,请让我知道。谢谢!

代码语言:javascript
复制
<!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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-18 23:04:49

你需要搬家

代码语言:javascript
复制
this._createGrid(stories);

在循环之外:

代码语言:javascript
复制
 _onDataLoaded: function(store, data){
                var stories = [];
                Ext.Array.each(data, function(story) {
                            var s  = {
                                FormattedID: story.get('FormattedID'),
                                Name: story.get('Name'),
                            };
                            stories.push(s);
                }, this);
                this._createGrid(stories);
    },    
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17711709

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档