2014-08-28 21 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

相關問題