因此,我一直在开发一个自定义数据透视应用程序以添加到拉力赛中,并且遇到了添加向下钻取功能的问题,其中在数据透视表下方加载了一个拉力赛网格,其中包含填充数据透视表的记录。我遇到的问题是在第一次单击时创建了商店,但是应该调用 _newGrid 函数的 load:function 永远不会被调用。我没有收到任何错误, 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);
}
});