2014-08-28 25 views
-3

我是新来的拉力赛以及javascript.I已从本网站采取脚本,我想包括迭代名称与记录。但它给了我对象对象消息,当我执行HTML Page.I需要解决这个问题。寻求帮助和提前感谢。用户故事对象上具有依赖关系的用户故事基于迭代

-Mani

description here][1] 

<!DOCTYPE html> 
<html> 
*emphasized text*<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: 
       ['FormattedID','Name','Iteration','Predecessors','FormattedID','CreationDate'], 
         autoLoad: true, 



         listeners: { 
          load: this._onDataLoaded, 
                  ///query: q, 
          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 = ""; 

         // Loop through and process Predecessor data 
         for (var i=0; i<myPredecessors.length; i++) { 
          thisPredecessor = myPredecessors[i]; 
          thisPredecessorFormattedID = thisPredecessor["FormattedID"]; 
          thisPredecessorName = thisPredecessor["Name"]; 

          // Re-format Date/time string 
          thisPredecessorCreationDateString = thisPredecessor["CreationDate"]; 
          thisPredecessorCreationDate = new 
          Date(thisPredecessorCreationDateString); 
          thisYear = thisPredecessorCreationDate.getFullYear(); 
          thisMonth = thisPredecessorCreationDate.getMonth(); 
          thisDay = thisPredecessorCreationDate.getDate(); 

          thisPredecessorFormattedDate = thisMonth + "/" + thisDay + "/" + 
          thisYear; 

          // Post-pend updated data to value for array 
          predecessorData += thisPredecessorFormattedID + ": " + 
          thisPredecessorName + "<br>"        
          predecessorCreationDate += thisPredecessorFormattedDate + "<br>";          
         } 


         records.push({ 
          FormattedID: record.get('FormattedID'), 
          Name: record.get('Name'), 
          Iteration: String(record.get('Iteration')), 
          Predecessors: predecessorData, 
          PredecessorCreationDate: predecessorCreationDate, 

          }); 
        }); 

        this.add({ 
         xtype: 'rallygrid', 
         store: Ext.create('Rally.data.custom.Store', { 
          data: records, 
          pageSize: 20 
         }), 
         columnCfgs: [ 
          { 
           text: 'FormattedID', dataIndex: 'FormattedID', width: '60px' 
          }, 
          { 
           text: 'Name', dataIndex: 'Name', width: '400px' 
          }, 
      { 
           text: 'Iteration', dataIndex: 'Iteration', width: '500px' 
          }, 
          { 
           text: 'Predecessors', dataIndex: 'Predecessors', width: '200px' 
          }, 
          { 
           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> 
+1

哪里是你的代码? – blex 2014-08-28 12:47:54

+0

我刚才添加了。我还想包括基于迭代的过滤条件。 – 2014-08-28 12:54:38

+0

此HTML代码将用于生成一个报告。将有过滤条件必须添加打印选项。如果我可以得到完整的代码,它会更有帮助。寻找你的帮助。 – 2014-09-01 06:03:04

回答

0

迭代属性是对WS API在实际迭代对象的引用。你需要使用一个语法像这样遍历名称:

Iteration: (record.get('Iteration') && record.get('Iteration')._refObjectName) || 'None' 

你要检查迭代不是null你面前输出record.get('Iteration')._refObjectName)

+0

它填充了记录。我只需要一个更多的帮助。我想通过迭代过滤将其作为报告打印出来。你可以帮我吗..? – 2014-09-01 06:12:20

相关问题