我正在尝试创建一个投资组合项目报告,该报告将 Rally.ui.grid.Grid 用于某些属性信息,并使用 Ext.panel.Panel 用于描述。因为我想一对一地匹配这些信息,所以我正在通过数据查询进行分页。一切都可以向我展示我想要格式化的数据,但来自最终调用的数据会填充每个网格(第 3 页填充网格 1-3)。这让我想知道商店是否通过引用传递到网格中,以及如何更改它以使其对每个网格都是唯一的。下面是代码片段:
_loadScopeDetails: function() {
Ext.create('Rally.data.WsapiDataStore', {
autoLoad: true,
pageSize: 1, // Load 1 page at a time
limit: 1, // Limit to 1
model: 'PortfolioItem/MMF',
context: MyApp.globalContext,
fetch: ['Parent',
'Project',
'Name',
'InvestmentCategory',
'PlannedStartDate',
'PlannedEndDate',
'Description'
],
filters: [
{
property: 'Parent.Name',
operator: 'Contains',
value: MyApp.selectedEpicName
}
],
sorters: {
property: 'Rank',
direction: 'ASC'
},
listeners: {
load: function( store, records ) {
MyApp._buildScopeDetails( store, records );
// Load the next until all pages are loaded
if ( store.currentPage < store.totalCount )
{
store.loadPage( store.currentPage+1 );
}
else
{
var index = 0;
for (index=0; index< store.totalCount; index++ ){
MyApp.scopePane.add(MyApp.scopeDetails[index]);
MyApp.scopePane.add(MyApp.scopeDescription[index] );
}
}
}
}
});
},
_buildScopeDetails: function(myStore, records) {
// Filter off the epic from the scope title
var epicTitle = MyApp.selectedEpicName + ': ';
var title = records[0].data.Name;
if ( 0 === title.indexOf( epicTitle ) ) {
title = title.substr( epicTitle.length );
}
MyApp.scopeDetails.push( Ext.create('Rally.ui.grid.Grid', {
store: myStore, // This seems to be referenced in all grids!?!?!
title: '<a href=\'' + Rally.nav.Manager.getDetailUrl( records[0] ) + '\'>' + title + '</a>',
border: 1,
columnCfgs: [
'Name',
{dataIndex: 'c_SAPProjectNumber', text:'SAP #'},
'InvestmentCategory',
'PlannedStartDate',
'PlannedEndDate',
'Project'
],
showPagingToolbar: false
}) );
MyApp.scopeDescription.push( Ext.create('Ext.panel.Panel', {
width: '100%',
html: '<p>' + records[0].data.Description + '</p>',
renderTo: Ext.getBody()
}) );
},