2

我如何在功能级别获取数据

eg : General
       ID: F1780
       Name: XYZ
       Description:  XXXX

     Project:
   Region - Americas

     Schedule
       Release: 2013 Jul

请建议我如何获得上述数据。

4

1 回答 1

0

下面是一个功能网格示例,其中包含 ID、名称、描述、项目、发布和关联的用户故事列。

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',

    launch: function() {
        console.log("PI GRID");
        Ext.create('Rally.data.WsapiDataStore', {
            model: 'PortfolioItem/Feature',
            fetch: ['FormattedID','Name','Description','UserStories','Release','Project'],
            pageSize: 100,
            autoLoad: true,
            listeners: {
                load: this._onDataLoaded,
                scope: this
            }
        });
    },

    _createGrid: function(features) {
         this.add({
            xtype: 'rallygrid',
            store: Ext.create('Rally.data.custom.Store', {
                data: features,
                pageSize: 100
            }),

            columnCfgs: [
                {
                   text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },
                {
                    text: 'Name', dataIndex: 'Name'
                },
                {
                    text: 'Description', dataIndex: 'Description'
                },
                {
                    text: 'Release', dataIndex: 'Release'
                },
                {
                    text: 'Project', dataIndex: 'Project'
                },
                {
                    text: 'Story Count', dataIndex: 'StoryCount'
                },
                {
                    text: 'User Stories', dataIndex: 'UserStories', 
                    renderer: function(value) {
                        var html = [];
                        Ext.Array.each(value, function(userstory){
                            html.push('<a href="' + Rally.nav.Manager.getDetailUrl(userstory) + '">' + userstory.FormattedID + '</a>')
                        });
                        return html.join(', ');
                    }
                }
            ]

        });
    },
    _onDataLoaded: function(store, data){
                var features = [];
                var pendingstories = data.length;
                Ext.Array.each(data, function(feature) {
                            var release = feature.get('Release');
                            var f  = {
                                FormattedID: feature.get('FormattedID'),
                                Name: feature.get('Name'),
                                Description: feature.get('Description'),
                                Release: (release && release.Name) || 'None',
                                Project: feature.get('Project')._refObjectName,
                                _ref: feature.get("_ref"),
                                StoryCount: feature.get('UserStories').Count,
                                UserStories: []
                            };

                            var stories = feature.getCollection('UserStories');
                           stories.load({
                                fetch: ['FormattedID'],
                                callback: function(records, operation, success){
                                    Ext.Array.each(records, function(story){
                                        var number = story.get('DirectChildrenCount');  
                                        if (number == 0) {
                                            f.UserStories.push({_ref: story.get('_ref'),
                                                        FormattedID: story.get('FormattedID')
                                                    });}
                                    }, this);

                                    --pendingstories;
                                    if (pendingstories === 0) {
                                        this._createGrid(features);
                                    }
                                },
                                scope: this
                            });
                            features.push(f);
                }, this);
    }             
});
于 2013-09-02T19:13:41.477 回答