Rally App2.0-检索特定故事

Rally App2.0-检索特定故事,rally,agile-central,Rally,Agile Central,我已经掌握了2.0的诀窍,但有些东西似乎很简单 基本上,我已经创建了一个新的应用程序供我的团队使用(感谢大家的帮助)。我想如果有一种方法可以将消息添加到仪表板上,那就太酷了 我决定最简单的方法就是创建一个故事,然后在我的代码中简单地查询一个故事,抓取描述并在应用程序中显示。听起来很简单,对吧 我花了一点时间抓取描述字段并显示它。我知道这听起来很奇怪,但似乎很复杂。我试过这种方法 showMessage: function (message) {

我已经掌握了2.0的诀窍,但有些东西似乎很简单

基本上,我已经创建了一个新的应用程序供我的团队使用(感谢大家的帮助)。我想如果有一种方法可以将消息添加到仪表板上,那就太酷了

我决定最简单的方法就是创建一个故事,然后在我的代码中简单地查询一个故事,抓取描述并在应用程序中显示。听起来很简单,对吧

我花了一点时间抓取描述字段并显示它。我知道这听起来很奇怪,但似乎很复杂。我试过这种方法

            showMessage: function (message) {
                debugger;
                this.add({
                    xtype: 'label',
                    html: message
                });
            },

            getMessage: function () {
                var defectStore = Ext.create('Rally.data.WsapiDataStore', {
                    model: 'UserStory',
                    fetch: ['Description'],
                    filters: [{
                        property: 'FormattedID',
                        operator: '=',
                        value: 'US13258'
                    }],
                    autoLoad: true,
                    listeners: {
                        load: function (store, records) {
                            debugger;
                            if (records)
                                return records[0].get("Description");
                        }
                    }
                });
            },
但似乎被意大利面事件缠住了。当然还有更简单的方法:)


只想获取一个特定的故事描述字段…

您可以使用模型的加载方法来执行此操作:

var storyOid = 12345;

//Get the story model
Rally.data.ModelFactory.getModel({
    type: 'UserStory',
    success: function(model) {

        //Load the specific story
        model.load(storyOid, {
            fetch: ['Description']
            success: function(record) {

                //success!
                var description = record.get('Description');
            }
        });
    }
});

我不确定您为什么要尝试使用侦听器,但我会调用load并在成功后获得结果,如下所示:

getMessage: function (storyID) {
    var defectStore = Ext.create('Rally.data.WsapiDataStore', {
        model: 'UserStory',
        fetch: ['Description'],
        filters: [{
            property: 'FormattedID',
            operator: '=',
            value: storyID
        }],
        autoLoad: true
    });

    defectStore.load({scope: this, callback: function(records, operation, success) {
        if(success){
            console.log(records[0].get('Description')); // additional logic here
        } else {
            console.log('You ruined the store. Jerk.');
        }
    }});
}

不过,我认为您可能会遇到一些问题,除非在检查成功后调用showMessage,因为extJS是异步运行的。

这就解决了问题,我不太了解默认模型,但这总结起来相当不错。我遇到的唯一问题是.getDescriptin无效。我最终得到了record.data.Description。谢谢你的帮助!是的,是我的错。应该是记录。get('Description');