2013-03-01 4 views

답변

0

다음은이 작업을 수행하는 방법을 보여주는 간단한 예입니다. 전신 FormattedID를 링크로 렌더링하는 서식 지정 기능을 만들어 약간 더 멋지게 만들 수 있지만 기본적인 아이디어는 다음과 같습니다.

<!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: ['FormattedID','Name','Predecessors','FormattedID','CreationDate'], 
          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 = ""; 

          // 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'), 
           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: '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> 
+0

빠른 응답 감사합니다. 본인의 원래 진술에서 명확하지 않은 답변을 보았습니다. 제 사과를 받아주세요. 전임자 인 User Story가 만들어 졌을 때 알아내는 데 관심이 없습니다. 또한이 날짜는 1 개월 전인 것으로 보입니다. 사용자 스토리가 다른 사용자 스토리의 전신이 된 날짜를 찾는 데 관심이 있습니다. 개정 내역에서 "PREDECESSORS added ["와 그 날짜를 원합니다. 감사합니다, – JimD

+0

빠른 응답 감사합니다. 본인의 원래 진술에서 명확하지 않은 답변을 보았습니다. 제 사과를 받아주세요. 전임자 인 User Story가 만들어 졌을 때 알아내는 데 관심이 없습니다. 또한이 날짜는 1 개월 전인 것으로 보입니다. 사용자 스토리가 다른 사용자 스토리의 전신이 된 날짜를 찾는 데 관심이 있습니다. 개정 내역에서 "PREDECESSORS added ["와 그 날짜를 원합니다. 감사합니다, – JimD

+0

이렇게 할 수 있습니다. 위 샘플은 선행자 대신'Successors' 컬렉션을 가져오고'RevisionHistory' 컬렉션을 가져 오도록 조정해야합니다. 그런 다음 RevisionHistory를 반복하여 후속 세트가있는 Story 자체에 해당하는 Revision을 식별하고 추출해야합니다. –

관련 문제