Javascript 我可以提取创建前置程序的日期吗?

Javascript 我可以提取创建前置程序的日期吗?,javascript,rally,Javascript,Rally,我想创建一个应用程序,列出用户故事和它的前身,以及它们创建(添加)到Rally的日期 有没有我可以使用的例子?这里有一个简单的例子来说明如何做到这一点。您可以通过创建一个格式化函数来将前置FormattedID呈现为链接,从而使其更为华丽,但这应该会让您了解以下基本概念: <!DOCTYPE html> <html> <head> <title>UserStoryWithPredecessors</ti

我想创建一个应用程序,列出用户故事和它的前身,以及它们创建(添加)到Rally的日期


有没有我可以使用的例子?

这里有一个简单的例子来说明如何做到这一点。您可以通过创建一个格式化函数来将前置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>

用户故事与前辈
onReady(函数(){
Ext.define('CustomApp'{
扩展:“Rally.app.app”,
组件CLS:“应用程序”,
启动:函数(){
Ext.create('Rally.data.WsapiDataStore'{
模型:“用户故事”,
获取:['FormattedID'、'Name'、'Preferences'、'FormattedID'、'CreationDate'],
自动加载:对,
听众:{
加载:这个。加载后,
范围:本
}
});
},                
_onDataLoaded:函数(存储、数据){
var记录=[];
Ext.Array.each(数据、函数(记录){
//使用此处的数据执行自定义操作
//计算等。
var mypreventors=record.get('preventors');
var前置数据=”;
var predecessorCreationDate=“”;
//循环并处理前置数据

对于(var i=0;我感谢您的快速响应。从看到您的响应我意识到我在原始声明中不清楚。请接受我的道歉。我不想知道用户故事(即前身)是何时创建的。而且这个日期似乎早了一个月。我想知道用户故事的日期story成为另一个用户story的前身。在修订历史记录中,它将声明“Preferences added”[“我想要那个日期。尊敬的,谢谢你的快速回复。从看到你的回复我意识到我在我的原始声明中不清楚。请接受我的道歉。我不想知道用户故事(即前身)是何时创建的。而且这个日期似乎早了一个月。我想知道ut一个用户故事成为另一个用户故事的前身的日期。在修订历史记录中,它会声明“Precedures added”[“我想要那个日期。就这一点而言,这是可能的。上面的示例需要进行调整,以便它提取
继任者
集合,而不是前任,并且提取
修订历史
集合。然后,您需要在修订历史中循环,以识别和提取相应的修订感谢你的回复。我担心这超出了我简单的用户能力。