Rally 2.0 SDK - 过滤每个项目的用户故事

时间:2013-07-30 19:38:53

标签: rally

我想为Rally中的每个项目过滤用户故事,而不仅仅针对当前选择的项目。有可能吗?

1 个答案:

答案 0 :(得分:2)

此代码使用rallyprojectpicker并根据项目选择刷新网格:

<!DOCTYPE html>
<html>
<head>
    <title>Stories By Project</title>

    <script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0rc1/sdk.js"></script>

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

                items: [
                    {
                        xtype: 'container',
                        itemId: 'projFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'grid'
                    }
                ],

                launch: function() {

                    this.down('#projFilter').add({
            xtype: 'rallyprojectpicker',
                        itemId: 'projPicker',
            workspace: '/workspace/12352608129',
            value: '/project/12527515559',  //default
                        listeners: {
                            change: this._onProjectChange,
                            scope: this
                        }
                    });
                },

        _onProjectChange: function()
        {
            if(!this.model) {
                this._retrieveModel();
            } else {
                this._refreshGrid();
            }
        },

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

                _refreshGrid: function() {
            this.grid.reconfigure(this._buildStore());
                },

        _buildStore: function() {
           return Ext.create('Rally.data.WsapiDataStore', {
               model: this.model,
               autoLoad: true,
               context: {
                   projectScopeUp: false,
                   projectScopeDown: false,
                   project: this.down('#projPicker').getValue()
               }
         });
        },

                _onModelRetrieved: function(model) {
            this.model = model;
                    this.grid = this.down('#grid').add({
                          xtype:'rallygrid',
              store: this._buildStore(),
                          columnCfgs:[
                              'FormattedID',
                              'Name'
                          ]

                    });
                }
            });

            Rally.launchApp('CustomApp', {
                name: 'Stories By Project'
            });
        });
    </script>

    <style type="text/css">
    </style>
</head>
<body></body>
</html>