javascript - Rally 自定义应用程序复选框过滤器不起作用

标签 javascript checkbox rally

我正在尝试创建一个自定义应用程序,允许我通过 Iteration(xtype: 'rallyiterationcombobox') 进行搜索,然后使用复选框(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/#!/example/filterable-grid

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

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

这里的示例展示了如何执行该部分(虽然它是刷新板,但刷新网格应该与上面的可过滤网格示例相同):

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

关于javascript - Rally 自定义应用程序复选框过滤器不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28375815/

相关文章:

javascript - 为什么 Angular Digest Cycle 没有被调用?

javascript - 如果使用 Javascript 选择复选框,如何要求输入字段?

java - 客户计算机上的 Apache httpclient 超时(处理请求时捕获 I/O 异常 : Connection timed out

node.js - 如何从 Rally API 获取相关对象

java - 在 Rally 中如何使用 Web 服务 v2.0 获得优先级、严重性下拉列表选项

javascript - 如何正确使用Promise.all?

javascript - 是否可以交互式地可视化 10000 个 31x31 等高线图?

javascript - 南非移动 Javascript 正则表达式

c# - 如何访问流程布局面板中的复选框值?

html - 自定义单选按钮,与其他label标签冲突