拉力赛自定义HTML - 过滤里程碑

时间:2016-07-02 03:22:17

标签: javascript rally

我正在创建一个" Rally Custom HTML"使用此分组网格示例的板 https://help.rallydev.com/apps/2.1/doc/#!/example/groupable-grid

我在为特定里程碑添加过滤器时遇到问题。我可以通过以下代码返回用户故事而不会出现问题。它在名称上有一个通用过滤器。

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

    <script type="text/javascript" src="/apps/2.0/sdk.js"></script>

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

                launch: function() {
                    this.add({
                        xtype: 'rallygrid',
                        columnCfgs: [
                            'FormattedID',
                            'Name',
                            'ScheduleState',
                            'Milestones'
                        ],
                        context: this.getContext(),
                        features: [{
                            ftype: 'groupingsummary',
                            groupHeaderTpl: '{name} ({rows.length})'
                        }],
                        storeConfig: {
                            model: 'UserStory',
                            groupField: 'Project',
                            groupDir: 'ASC',
                            filters : [
                                {
                                    property : 'Name',
                                    operator : 'contains',
                                    value : ' ' 
                                }
                            ],
                            fetch: ['Project'],
                            getGroupString: function(record) {
                                var Project = record.get('Project');
                                return (Project && Project._refObjectName) || 'No Project';
                            }
                        }
                    });
                }
            });

            Rally.launchApp('CustomGrid', {
              name: 'Custom Grid'
            });
        });
    </script>

    <style type="text/css">

    </style>
</head>
<body></body>
</html>

当我尝试更改过滤器以使用&#34;里程碑&#34;它不会返回任何结果。我能够访问里程碑属性,将其显示为一列。

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

    <script type="text/javascript" src="/apps/2.0/sdk.js"></script>

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

                launch: function() {
                    this.add({
                        xtype: 'rallygrid',
                        columnCfgs: [
                            'FormattedID',
                            'Name',
                            'ScheduleState',
                            'Milestones'
                        ],
                        context: this.getContext(),
                        features: [{
                            ftype: 'groupingsummary',
                            groupHeaderTpl: '{name} ({rows.length})'
                        }],
                        storeConfig: {
                            model: 'UserStory',
                            groupField: 'Project',
                            groupDir: 'ASC',
                            filters : [
                                {
                                    property : 'Milestones',
                                    operator : 'contains',
                                    value : ' ' 
                                }
                            ],
                            fetch: ['Project'],
                            getGroupString: function(record) {
                                var Project = record.get('Project');
                                return (Project && Project._refObjectName) || 'No Project';
                            }
                        }
                    });
                }
            });

            Rally.launchApp('CustomGrid', {
              name: 'Custom Grid'
            });
        });
    </script>

    <style type="text/css">

    </style>
</head>
<body></body>
</html>

1 个答案:

答案 0 :(得分:0)

如果您知道您尝试过滤的里程碑的ObjectId,则可以制作如下过滤器:

{
    property : 'Milestones',
    operator : 'contains',
    value : '/milestone/12345' 
}

或者,您也可以按名称搜索:

{
    property : 'Milestones.Name',
    operator : 'contains',
    value : 'A Milestone' 
}

您也可以将网址粘贴到浏览器中进行测试,直到您获得正确的查询:

https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement?query=(Milestones contains /milestone/12345)