Javascript在执行此代码时返回对象对象错误。由于我是javascript的新手,我无法识别具体问题。用户故事的名称也没有与Userstory id正确对齐。寻求帮助。提前谢谢。
<!DOCTYPE html>
<html>
<head>
<title>UserStoryWithPredecessors</title>
<script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0p5/sdk.js"></script>
<script type="text/javascript">
Rally.onReady(function() {
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
Ext.create('Rally.data.WsapiDataStore', {
model: 'UserStory',
fetch:
['Iteration','FormattedID','Name','Predecessors','PredecessorID','Project','ScheduleState'],
filters: [
{
property: 'Iteration.Name',
operator: '=',
value: 'RT4 Iteration #4'
}
],
autoLoad: true,
listeners: {
load: this._onDataLoaded,
scope: this
}
});
},
_onDataLoaded: function(store, data) {
var records = [];
Ext.Array.each(data, function(record) {
//Perform custom actions with the data here
//Calculations, etc.
var myPredecessors = record.get('Predecessors');
var predecessorData = "";
var predecessorCreationDate = "";
var predecessorState = "";
var predecessorProject = "";
var predecessorID = "";
var predecessorName = "";
// Loop through and process Predecessor data
for (var i=0; i<myPredecessors.length; i++) {
thisPredecessor = myPredecessors[i];
thisPredecessorFormattedID = thisPredecessor["FormattedID"];
thisPredecessorName = thisPredecessor["Name"];
thisPredecessorScheduleState=thisPredecessor["ScheduleState"];
thisPredecessorProject= thisPredecessor["Project"];
// Post-pend updated data to value for array
// predecessorData += thisPredecessorFormattedID + ": " +
thisPredecessorName + "<br>"
predecessorID += thisPredecessorFormattedID + "<br>";
predecessorName += thisPredecessorName + "<br>";
predecessorState += thisPredecessorScheduleState + "<br>";
predecessorProject += thisPredecessorProject + "<br>";
}
records.push({
FormattedID: record.get('FormattedID'),
Name: record.get('Name'),
Iteration:
(record.get('Iteration')&&record.get('Iteration')._refObjectName) || '',
PredecessorID : predecessorID,
PredecessorName : predecessorName,
PredecessorState: predecessorState,
PredecessorProject: predecessorProject,
});
});
this.add({
xtype: 'rallygrid',
store: Ext.create('Rally.data.custom.Store', {
data: records,
pageSize: 20
}),
columnCfgs: [
{
text: 'Iteration', dataIndex: 'Iteration', width: '100px'
},
{
text: 'FormattedID', dataIndex: 'FormattedID', width: '100px'
},
{
text: 'Name', dataIndex: 'Name', width: '400px'
},
{
text: 'PredecessorID', dataIndex: 'PredecessorID', width: '100px'
},
{
text: 'PredecessorName', dataIndex: 'PredecessorName', width:
'200px'
},
{
text: 'Project', dataIndex: 'PredecessorProject', width: '200px'
},
{
text: 'State', dataIndex: 'PredecessorState', width: '400px'
}
//,
//{
// text: 'Predecessor Creation Date(s)', dataIndex:
'PredecessorCreationDate', width: '200px'
// }
]
});
}
});
Rally.launchApp('CustomApp', {
name: 'UserStoryWithPredecessors'
});
});
</script>
<style type="text/css">
.app {
/* Add app styles here */
}
</style>
</head>
<body></body>
</html>
答案 0 :(得分:1)
我已经找到了一个回答我自己的问题。我在代码中做了一些小修改并且它有效。 thisPredecessorProject = thisPredecessor [“Project”] ._ refObjectName;
我需要将此表打印到报告中。寻求您的帮助。谢谢。