集会的实验层次树

时间:2014-06-27 20:00:10

标签: rally appsdk2

我看到在拉力赛网站(https://help.rallydev.com/apps/2.0rc3/doc/#!/api/Rally.ui.grid.TreeGrid)上将分层树标记为实验树。我想使用分层树构建一个应用程序,我有一些关于这些功能的问题。是否可以过滤树?我也可以为给定的用户(估计,待办事项,实际等)添加任务的总数,并将该总数列为用户值?是否有另一种方法可以获取其下方列表中的任务的用户列表?

1 个答案:

答案 0 :(得分:0)

一个非树格的示例:此应用程序使用按工作产品(用户素材)分组的当前迭代中的任务网格中的组和摘要功能,其中总结了各个任务的估计值。完整代码位于this github repo

launch: function() {
        var that = this;
        var today = new Date().toISOString();
        var stories = Ext.create('Rally.data.wsapi.Store', {
            model: 'UserStory',
            fetch: ['Tasks'],
            filters: [
                {
                    property: 'Iteration.StartDate',
                    operator: '<=',
                    value: today
                },
                {
                    property: 'Iteration.EndDate',
                    operator: '>=',
                    value: today
                }
            ]
        });
        stories.load().then({
            success: this.loadTasks,
            scope: this
        }).then({
            success:function(results) {
                that.makeGrid(results);
            },
            failure: function(){
                console.log("oh noes!")
            }
        });
    },

    loadTasks: function(stories){
        console.log("load tasks",stories)
        var promises = [];
        _.each(stories, function(story){
            var tasks = story.get('Tasks');
            if (tasks.Count > 0) {
                tasks.store = story.getCollection('Tasks',{fetch:['Name','FormattedID','Estimate','State','Blocked','WorkProduct']});
                promises.push(tasks.store.load());
            }
        });
        return Deft.Promise.all(promises);
    },


    makeGrid: function(results){
        var tasks = _.flatten(results);
        var data = [];
        _.each(tasks, function(task){
            data.push(task.data);
        })

        _.each(data, function(record){
            record.Story = record.WorkProduct.FormattedID + " " + record.WorkProduct.Name;;
        })


        this.add({
            xtype: 'rallygrid',
            showPagingToolbar: true,
            showRowActionsColumn: true,
            editable: false,
            store: Ext.create('Rally.data.custom.Store', {
                data: data,
                groupField: 'Story',
            }),
            features: [{ftype:'groupingsummary'}],
            columnCfgs: [
                {
                    xtype: 'templatecolumn',text: 'ID',dataIndex: 'FormattedID',width: 100,
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate'),
                    summaryRenderer: function() {
                        return "Estimate Total"; 
                    }
                },
                {
                    text: 'Name',dataIndex: 'Name',
                },
                {
                    text: 'State',dataIndex: 'State',xtype: 'templatecolumn',
                        tpl: Ext.create('Rally.ui.renderer.template.ScheduleStateTemplate',
                            {
                                states: ['Defined', 'In-Progress', 'Completed'],
                                field: {
                                    name: 'State' 
                                }
                        })
                },
                {
                    text: 'Estimate',dataIndex: 'Estimate',
                    summaryType: 'sum',
                },
                {
                    text: 'WorkProduct',dataIndex: 'WorkProduct',
                    renderer: function(val, meta, record) {
                        return '<a href="https://rally1.rallydev.com/#/detail/userstory/' + record.get('WorkProduct').ObjectID + '" target="_blank">' + record.get('WorkProduct').FormattedID + '</a>';
                    }
                },
            ]
        });

    }

更新:如果要过滤任务商店,请在此处添加过滤器:

tasks.store = story.getCollection('Tasks',{fetch:['Name','FormattedID','Estimate','State','Blocked','WorkProduct'],filters:{property: 'State',operator: '<',value: 'Completed'}});

一个treegrid示例:你提到的Rally.ui.grid.TreeGrid仍在进行中。我还没有看到使用treegrid的故事层次结构的工作示例,但这并不意味着它是不可能的。

当我测试故事层次时,儿童故事没有出现在史诗故事中,但是故事/任务层次结构有效。过滤也有效。这是一个例子:

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch:function(){
        Ext.create('Rally.data.wsapi.TreeStoreBuilder').build({
            models: ['userstory'],
             autoLoad: true,
             filters:[
                {
                    property: 'Name',
                    operator: 'contains',
                    value: 'story'
                }
             ],
             enableHierarchy: true
            }).then({
             success: function(store) {
                var grid = Ext.create('Ext.Container', {
                    items: [{
                        xtype: 'rallytreegrid',
                        columnCfgs: [
                            'Name',
                            'Owner'
                        ],
                        store: store
                    }]
                });
                that.add(grid);

            }
        });
    } 

下面的屏幕截图显示,任务按预期嵌套在子故事下,但子故事不嵌套在父级下。网格按名称按预期过滤:

enter image description here