尝试创建Say / Do比率网格,面临以特定格式获取数据的问题

时间:2014-12-03 13:26:36

标签: extjs rally extjs4.2

实际上我正在创建一个Say / Do比率网格,现在看起来像这样。

enter image description here

希望显示每个迭代使用IterationCumulativeFlowData接受,提交和比率的点数。为此,我想要以下格式的数据,一个Iteration Ids数组,每个Iteration ID,70 IterationCumulativeFlowData的数组,但我没有正确得到这个 我也发布了一些我的代码,在我出错的地方需要你的建议。提前致谢

Object->
   12788831428: Array[70]
   12788831496: Array[70]
   12788831702: Array[70]
   12788831704: Array[70]
   12788831706: Array[70]

            getCommulativeData: function(iteration) {   
                var secFilter = [];
                parsecumulativeflowdata = {};
                //console.log("itetetetete value", iteration[0].ObjectID);  
                for( i = 1; i < iteration.length - 1; i++){
                    if (i == 1) {
                        var filter1 = Ext.create('Rally.data.wsapi.Filter', {
                            property: 'IterationObjectID',
                            operator: '=',
                            value: iteration[i].ObjectID
                        });
                        filter1 = filter1.or({
                            property: 'IterationObjectID',
                            operator: '=',
                            value: iteration[i+1].ObjectID
                        }); 
                    }   
                    else {
                        filter1 = filter1.or({
                            property: 'IterationObjectID',
                            operator: '=',
                            value: iteration[i].ObjectID
                        });                         
                    }   
                };
                secFilter.push(filter1);
                console.log("filter value", secFilter);
                var filter = Ext.create('Rally.data.wsapi.Filter', {
                    property: 'IterationObjectID',
                    operator: '=',
                    value: iteration[0].ObjectID
                });
                filter = filter.or(secFilter);          
                filter.toString();
                //var val = iteration[i].ObjectID;
                Ext.create('Rally.data.wsapi.Store', {
                    autoLoad: true,
                    //limit: Infinity,
                    model: 'IterationCumulativeFlowData',
                    context: {
                        project: this.getContext().getProject()._ref,
                        projectScopeDown: true,
                        projectScopeUp: false
                    },                          
                    fetch: ['CreationDate','CardEstimateTotal','CardState', 'IterationObjectID', 'Project'],
                    filters: [
                        secFilter
                    ],  
                    listeners: {
                        load: function(store, records) {
                            var iterationArray = {};
                            var cumulativeflowArray = [];
                            console.log("cummulative flow", records);
                            Ext.Array.each(records, function(record){
                                cumulativeflowArray.push(record.data);
                                iterationArray[record.data.IterationObjectID] = Ext.Array.flatten(cumulativeflowArray);
                            }, this);
                            console.log("iterationarray values", iterationArray);
                            //this.recurseCommulativeArray[record.IterationObjectID] = Ext.Array.flatten(cumulativeflowArray);
                        },
                        scope: this
                    }
                    //return 
                }, this);

getCommulativeData:function(iteration) - 在这个迭代中是3个团队和4个sprint的12个对象的数组(26.1,26.2,26.3,26.4),所以它有12个对象

1 个答案:

答案 0 :(得分:0)

其实我没有正确循环,它应该是这样的。

getCommulativeData: function(iteration) {
console.log("itetetetete value", iteration);
var secFilter = []; var filter1 = null; parsecumulativeflowdata = {}; for( i = 0; i < iteration.length; i++){ if (i == 0) { filter1 = Ext.create('Rally.data.wsapi.Filter', { property: 'IterationObjectID', operator: '=', value: iteration[i].ObjectID }); }
else { filter1 = filter1.or({ property: 'IterationObjectID', operator: '=', value: iteration[i].ObjectID });
}
//secFilter.push(filter1); };