0

ユーザー ストーリーとその前任者を Rally に作成 (追加) された日付とともに一覧表示するアプリを作成したいと考えています。

使用できる例はありますか?

4

1 に答える 1

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>
于 2013-03-04T00:11:33.257 に答える