检索项目名称

时间:2015-06-23 19:23:29

标签: rally

如何在拉力赛中获得项目名称?

我正在使用网格应用程序,而我想要做的就是为网格视图添加一个“项目”字段。但是,因为'Project'实际上是一个对象,结果字段是'[object Object]'。那么,如何在字符串类型中获取名称?

以下是我的columnCfgs中有关制作字段的代码。

{ text: 'Project', dataIndex: this.getContext().getProject().get },

1 个答案:

答案 0 :(得分:1)

尝试this.getContext().getProject()._refObjectNamethis.getContext().getProject().Name

在某些情况下,在控制台中打印和浏览对象很有用,因为您可能需要像在this gist中一样遍历project.data._refObjectName,或者在您的情况下:

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    items:{ html:'<a href="https://help.rallydev.com/apps/2.0/doc/">App SDK 2.0 Docs</a>'},
    launch: function() {
        var currentProject = this.getContext().getProject();
        console.log(currentProject);
        this.add({
            xtype:'container',
            html: currentProject.Name
        });

    }
});

enter image description here