1

无法显示用户故事的父功能并按同一父字段排序。这是我的代码。除非父级是另一个用户故事,否则我会在父列中看到空值。而且我无法按父字段排序。

您的帮助将不胜感激!

谢谢!

<script type="text/javascript">
        Rally.onReady(function() {
            Ext.define('CustomApp', {
                extend: 'Rally.app.App',
                componentCls: 'app',

                items: [
                    {
                        xtype: 'container',
                        itemId: 'iterationFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'grid',
                        width: 800
                    }
                ],

                launch: function() {
                    this.down('#iterationFilter').add({
                        xtype: 'rallyiterationcombobox',
                        cls: 'filter',
                        model: 'UserStory',
                        field: 'Iteration',
                        listeners: {
                            ready: this._onIterationComboBoxLoad,
                            select: this._onIterationComboBoxSelect,
                            scope: this
                        }
                    });
                },

                _onIterationComboBoxLoad: function(comboBox) {
                    this.iterationComboBox = comboBox;

                    Rally.data.ModelFactory.getModel({
                        type: 'UserStory',
                        success: this._onModelRetrieved,
                        scope: this
                    });
                },                  

                _getFilter: function() {
                    var filter = [];

                    filter.push({
                        property: 'Iteration',
                        operator: '=',
                        value: this.iterationComboBox.getValue()
                    });

                    return filter;
                },


                _onIterationComboBoxSelect: function() {
                    this._onSettingsChange();
                },

                _onSettingsChange: function() {
                    this.grid.filter(this._getFilter(), true, true);
                },

                _onModelRetrieved: function(model) {
                    this.grid = this.down('#grid').add({
                        xtype: 'rallygrid',
                        model: model,
                        columnCfgs: [
                            'FormattedID',
                            'Name',
                            'Plan Estimate',
                            'Parent',
                            'Schedule State',
                            'StoryType'
                        ],
                        storeConfig: {
                            context: this.context.getDataContext(),
                            filters: this._getFilter()
                        },
                        showPagingToolbar: true,
                        enableEditing: false
                    });
                }



            });
        });


      Rally.launchApp('CustomApp', {
          name: 'Defect Dashboard'
      });
</script>
4

3 回答 3

1

用户故事的父级有两个不同的字段。如果 Parent 是另一个故事,它使用 Parent。如果父项是像功能一样的投资组合项,则父项将被称为投资组合项。

您可以通过查看我们的网络服务文档来查看用户故事中的字段。

在您的示例中,您必须更改列配置以包含 PorfolioItem

columnCfgs: [
                            'FormattedID',
                            'Name',
                            'Plan Estimate',
                            'PortfolioItem',
                            'Schedule State',
                            'StoryType'
                        ],
于 2013-01-07T19:32:45.007 回答
0

使用渲染器查看修改后的解决方案,您只需要向已设置的自定义列添加一个 doSort 方法。确保在 store 上将 remoteSort 设置为 false,然后您可以使用以下方法覆盖排序:

        doSort: function(state) {
            var ds = this.up('grid').getStore();
            var field = this.getSortParam();
            ds.sort({
                property: field,
                direction: state,
                sorterFn: function(v1, v2){
                    v1 = v1.get(field);
                    v2 = v2.get(field);
                    return v1.length > v2.length ? 1 : (v1.length < v2.length ? -1 : 0);
                }
            });
        }

这个排序器碰巧按字段的长度排序,但你可以改变它来做你想做的事。请参见Ext js 按内容对自定义列进行排序

于 2013-08-01T18:32:09.933 回答
0

我至少能够显示每个用户故事的功能名称。我仍然有一个问题,使它可以排序。:(

    <!DOCTYPE html>
    <html>
    <head>
        <title>Grid Example</title>

        <script type="text/javascript" src="/apps/2.0p4/sdk.js?wsapiVersion=1.38"></script>
        <script type="text/javascript">
                Rally.onReady(function() {
                    Ext.define('CustomApp', {
                        extend: 'Rally.app.App',
                        componentCls: 'app',

                        items: [
                            {
                                xtype: 'container',
                                itemId: 'iterationFilter'
                            },
                            {
                                xtype: 'container',
                                itemId: 'grid'
                                //width: 800
                            }
                        ],

                        launch: function() {
                            this.down('#iterationFilter').add({
                                xtype: 'rallyiterationcombobox',
                                cls: 'filter',
                                model: 'UserStory',
                                field: 'Iteration',
                                listeners: {
                                    ready: this._onIterationComboBoxLoad,
                                    select: this._onIterationComboBoxSelect,
                                    scope: this
                                }
                            });
                        },

                        _onIterationComboBoxLoad: function(comboBox) {
                            this.iterationComboBox = comboBox;

                            Rally.data.ModelFactory.getModel({
                                type: 'UserStory',
                                success: this._onModelRetrieved,
                                scope: this
                            });
                        },                  

                        _getFilter: function() {
                            var filter = [];

                            filter.push({
                                property: 'Iteration',
                                operator: '=',
                                value: this.iterationComboBox.getValue()
                            });

                            return filter;
                        },


                        _onIterationComboBoxSelect: function() {
                            this._onSettingsChange();
                        },

                        _onSettingsChange: function() {
                            this.grid.filter(this._getFilter(), true, true);
                        },

                        _onModelRetrieved: function(model) {
                            this.grid = this.down('#grid').add({
                                xtype: 'rallygrid',
                                model: model,
                                columnCfgs: [
                                    'FormattedID',
                                    'Name',
                                    'PlanEstimate',
                                    {
                                        text: 'Feature',
                                        dataIndex: 'PortfolioItem',
                                        renderer: function(value, metaData, record, rowIndex, colIndex, store, view) {
                                            if (value != null) {
                                                return value.Name;
                                            }
                                            return '';
                                        }
                                    },
                                    'ScheduleState',
                                    'StoryType'
                                ],
                                storeConfig: {
                                    context: this.context.getDataContext(),
                                    remoteSort: false,
                                    filters: this._getFilter()
                                },
                                showPagingToolbar: true,
                                enableEditing: false
                            });
                        }



                    });
                });


              Rally.launchApp('CustomApp', {
                  name: 'Defect Dashboard'
              });
        </script>

        <style type="text/css">
            .filter {
                float: left;
                margin: 5px 5px;
                vertical-align: middle;
            }
        </style>
    </head>
    <body></body>
    </html>
于 2013-01-15T01:56:27.950 回答