1
我想创建一个投资组合项目报告,利用一个Rally.ui.grid.Grid的一些属性信息和一个Ext.panel.Panel的描述。因为我想匹配1对1的这些信息,所以我通过数据查询进行分页。一切工作,以显示我想要的数据格式,但从最后的呼吁数据填充每个网格(第3页填充网格1-3)。这让我想知道商店是否通过参考传递给网格,以及如何更改它,以便它对每个网格都是唯一的。以下是代码片段:是否通过引用传递了Rally WsapiDataStore?
_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()
}));
},
感谢您的建议。我改变它是递归的,并使用页面计数器创建新的数据存储在网格中使用。 –