所以我一直在研究自定义数据透视应用程序以添加到集会上,并且遇到了添加向下钻取功能的问题,其中在数据透视表下方加载了一个拉力网格,其中包含填充枢轴的记录。我遇到的问题是在第一次点击时创建了商店,但是应该调用_newGrid函数的load:函数永远不会被调用。我没有收到任何错误,load:function根本就没有被调用过。首次单击控制台登录显示:
[" F22826"] App.js?_dc = 0.7585907679242929:241
创建商店
第二次单击时控制台日志显示:
[" F22826"]
商店存在
数据构造函数{config:Object,
fetch:Array [5],autoload:true,filters:constructor,listeners: null ...} [constructor,constructor] true
创建网格
希望有人能帮助我理解我所缺少的东西
_getFilter: function (data, i) {
return {
property: 'FormattedID',
operator: '=',
value: data[i]
};
//console.log(filter);
//return filter;
},
//Creates the filter based on formatted ID to drill down
_createDrillMatrix: function (clickData) {
console.log(clickData);
var filter = [];
for (var i = 0; i < clickData.length; i++) {
filter.push([this._getFilter(clickData, i)]);
}
var finalFilter = JSON.stringify(filter);
finalFilter = finalFilter.replace(/\[/g, '{');
finalFilter = finalFilter.replace(/\]/g, '}');
finalFilter = finalFilter.replace(/^{/, '[');
finalFilter = finalFilter.replace(/}$/, ']');
finalFilter = finalFilter.replace(/{{/g, '{');
finalFilter = finalFilter.replace(/}}/g, '}');
finalFilter = JSON.parse(finalFilter);
finalFilter = Rally.data.wsapi.Filter.or(finalFilter);
//console.log(finalFilter);
var model= 'PortfolioItem/Feature';
this._createStore(finalFilter, model);
},
_createStore: function(filter, model){
if (this.filteredStore) {
console.log('Store Exists');
this.filteredStore.setFilter(filter);
this.filteredStore.load();
} else {
console.log('Create Store');
this.filteredStore = Ext.create('Rally.data.wsapi.Store', {
model: model,
fetch: ['FormattedID', 'Name', 'Owner', 'State', 'Release'],
autoload: true,
filters: filter,
listeners: {
load: function (myStore, myData, success) {
console.log('Data', myStore, myData, success);
if (!this.defectGrid) {
console.log('create grid');
this._newGrid(myStore);
}
},
scope: this
},
}
);
scope:this;
}
},
//adds grid to display drill down
_newGrid: function (filteredStore) {
this.defectGrid = Ext.create('Rally.ui.grid.Grid', {
store: filteredStore,
columnCfgs: ['FormattedID', 'Name', 'Owner', 'State', 'Release'],
limit: Infinity,
enableEditing: false,
});
this.add(this.defectGrid);
}
});
答案 0 :(得分:0)
我可能会建议您在商店配置中进行一些小改动:过滤器应该是一个数组。
filters: [filter]
答案 1 :(得分:0)
稍后再回来,我意识到我需要添加
that.filteredStore.load();
到_createStore函数的底部。实际上,即使autoload设置为true,商店也从未实际加载过。