Когда я запрашиваю истории пользователей, используя Rally.data.WsapiDataStore, я могу получить Iteration.StartDate и Iteration.EndDate. Однако, когда я загружаю коллекцию с использованием .getCollection («Предшественники»), Итерационное имя загружается, но StartDate и EndDate не заполняются. Код приложения записывается в консоль для изучения объекта Iteration.Iteration.StartDate недоступно
<!DOCTYPE html>
<html>
<head>
<title>Rally</title>
<script type="text/javascript" src="/apps/2.0rc3/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function() {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
launch: function() {
MyApp = this;
MyApp.globalContext = this.getContext().getDataContext();
MyApp.PredecessorSearch = [];
Ext.getBody().mask('Loading...');
// Update the filter
var filter = Ext.create('Rally.data.QueryFilter', {
property: 'DirectChildrenCount',
operator: '=',
value: '0'
});
var filter2 = Ext.create('Rally.data.QueryFilter', {
property: 'ScheduleState',
operator: '!=',
value: 'Accepted'
});
filter = filter.and(filter2);
Ext.create('Rally.data.WsapiDataStore', {
autoLoad: true,
limit: Infinity,
model: 'UserStory',
context: MyApp.globalContext,
fetch: ['Feature', 'Parent', 'Children',
'FormattedID', 'Name',
'ScheduleState', 'c_DevKanban',
'Release', 'Iteration', 'StartDate', 'EndDate',
'Blocked', 'BlockedReason',
'Predecessors',
'Owner','ObjectID' ],
filters: [ filter ],
sorters: [{
property: 'Rank',
direction: 'ASC'
}],
listeners: {
load: function (store, records) {
Ext.each(records, function(record) {
record.data.PredecessorData = [];
console.log("Story " + record.data.FormattedID, record.data.Iteration);
// Look for predecessors
//console.log(record.data.Predecessors);
if (record.data.Predecessors &&
record.data.Predecessors.Count > 0) {
MyApp._loadPredecessorsInStory(record);
}
// End of look for associated predecessors
});
var wait = function(condFunc, readyFunc, checkInterval) {
var checkFunc = function() {
if(condFunc()) { readyFunc(); }
else { setTimeout(checkFunc, checkInterval); }
};
checkFunc();
};
MyApp.PredecessorSearch.push('END');
wait(
function() {
return (MyApp.PredecessorSearch[0] == 'END');
},
function() {
Ext.getBody().unmask();
},
1000
);
}
}
});
},
_loadPredecessorsInStory: function (userStory) {
// Add this user story to the end of the list
MyApp.PredecessorSearch.push(userStory.data.FormattedID);
userStory.getCollection('Predecessors').load({
scope: this,
autoLoad: true,
limit: Infinity,
context: MyApp.globalContext,
fetch: ['Requirement',
'FormattedID', 'Name',
'State', 'ScheduleState', 'c_DevKanban',
'Release', 'Iteration', 'StartDate', 'EndDate',
'Blocked', 'BlockedReason',
'Owner','ObjectID' ],
filters: [ {
property: 'ScheduleState',
operator: '!=',
value: 'Accepted' }
],
callback: function(records, operation, success){
Ext.Array.each(records, function(record){
console.log("Predecessor " + record.data.FormattedID, record.data.Iteration);
});
// Remove this user story from the front of the list
MyApp._removeElement(MyApp.PredecessorSearch, userStory.data.FormattedID);
}
});
},
_removeElement: function(array, element) {
for(var i = array.length - 1; i >= 0; i--) {
if(array[i] === element) {
array.splice(i, 1);
return true;
}
}
return false;
}
});
Rally.launchApp('CustomApp', {
name:"Rally",
parentRepos:""
});
});
</script>
</head>
<body>
</body>
</html>
Это работало, чтобы переместить выборку в getCollection из загрузки. Спасибо, Кайл –