Rally自定义应用程序复选框筛选器不工作

Rally Custom App Checkbox filter not working

本文关键字:工作 筛选 复选框 自定义 应用程序 Rally      更新时间:2023-09-26

我正在尝试创建一个自定义应用程序,该应用程序允许我按迭代搜索(xtype:'rallyiterationmbobox'),然后使用复选框(xtype:'checkbox')只显示"阻止"的项目,并在网格上显示所有项目。

我的复选框有问题。我无法让它推送一个过滤器,只在网格上显示"阻止"的项目。我已经做了很多研究,我所做的是研究的总和(可能是问题的一部分),但遗憾的是,仍然没有进展。显示所有内容,但复选框不起作用。有什么建议吗?

<!DOCTYPE html>
<html>
<head>
<title>User Stories By Iteration</title>
<script type="text/javascript" src="/apps/2.0p4/sdk.js"></script>
<script type="text/javascript">
    Rally.onReady(function() {
        Ext.define('CustomApp', {
            extend: 'Rally.app.App',
            componentCls: 'app',
            //Containers for all items in the app
            items: [
                {
                    xtype: 'container',
                    itemId: 'dropdown'
                },
                {
                    xtype: 'container',
                    itemId: 'checkbox'
                },
                {
                    xtype: 'container',
                    itemId: 'grid'
                }
            ],
            launch: function() {
                //Dropdown box for selecting an iteration
                this.down('#dropdown').add({
                    xtype: 'rallyiterationcombobox',
                    margin: '10px 0px 0px 0px',
                    id: 'iterationComboBox',
                    listeners: {
                        ready: this._onLoad,
                        change: this._onChange,
                        scope: this
                    }
                });
                //Checkbox for toggling blocked items
                this.down('#checkbox').add({
                    xtype: 'checkbox',
                    id: 'blockedFilter',
                    fieldLabel: 'Find Blocked Items in Iteration?',
                    padding: '5,5,5,5',
                    margin: '-31px 0px 0px 225px',
                    handler: this._onChecked
                });
            },
            //Function that launches the grid
            _onLoad: function(comboBox) {
                Rally.data.ModelFactory.getModel({
                    type:'UserStory',
                    success:this._onModelRetrieved,
                    scope: this
                });
            },
            //Updates grid when iteration dropdown is changed
            _onChange: function() {
                var filterConfig = {
                    property:'Iteration',
                    operator: '=',
                    value: this.down('#iterationComboBox').getValue()
                };
                this.grid.filter(filterConfig, true, true);
            },
            //BEGIN: POINT OF INTEREST
            _getFilter: function() {
                var filter = [];
                if (Ext.getCmp('#blockedFilter').getValue()) this.grid.filter.push('Blocked');
                return filter;
            },
            _onChecked: function() {
                var changeBlock = this._getFilter();
                var config = {
                    types: changeBlock
                };
                this.grid.refresh(config);
            },
            //END: POINT OF INTEREST
            //Displays the main grid of information on the page
            _onModelRetrieved: function(model) {
                this.grid = this.down('#grid').add({
                    xtype:'rallygrid',
                    model: model,
                    id: 'iterationgrid',
                    pagingToolbarCfg:{
                        pageSizes: [25, 50, 100, 200]
                    },
                    columnCfgs:[
                        'FormattedID',
                        'Name',
                        'Iteration',
                        'Status',
                        'Blocked',
                        'Project'
                    ],
                    storeConfig:{
                        context: this.context.getDataContext(),
                        filters:[
                            {
                                property:'Iteration',
                                operator: '=',
                                value: this.down('#iterationComboBox').getValue()
                            },
                            {
                                property: 'Blocked',
                                operator: '=',
                                value: this.down('#blockedFilter').getValue()
                            }
                        ]
                    }
                });
            }
        });
        Rally.launchApp('CustomApp', {
            name: 'User Stories By Iteration'
        });
    });
</script>
<style type="text/css">
</style>
</head>
<body></body>
</html>

任何信息都是有用的,因为我是Rally和Javascript的新手。如果Rally中有一个功能已经做到了这一点,我想知道,但这个应用程序实际上是针对我想用自定义字段实现的功能,我只是想先把架构弄下来。

2.0p4是App SDK 2.0的一个非常旧的预览版本。如果可能的话,您应该升级到使用本周刚刚发布的2.0 GA版本。

在文档中查看此示例:http://help.rallydev.com/apps/2.0/doc/#/示例/可过滤网格

它使用组合框来过滤网格。替换复选框应该相当简单。

由于你似乎总是按迭代确定范围,你也可以扩展Rally.app.TimeboxScopedApp。这将允许你的应用程序在迭代范围内的自定义页面上工作,并简化你的代码(如果需要,它将为你创建迭代组合框)。

这里的例子展示了如何完成这一部分(虽然这是刷新一块板,但刷新一个网格应该与上面的可过滤网格例子相同):

http://help.rallydev.com/apps/2.0/doc/#/guide/timebox_filtering-section-timebox-rerequired-apps