使用自定义HTML应用程序时,是否可以在拉力赛网格中显示自定义投资组合字段?

时间:2014-07-23 18:05:39

标签: rally appsdk2

我的目标是使用仪表板上的拉力赛网格在custon HTML应用程序中显示一些自定义的组合字段(该字段称为执行冠军)。我已经查看了文档和一些示例,看起来这不可能。有没有人完成这个以及怎么做?我的代码如下。我使用以下内容开始https://github.com/davidpthomas/BasicRallyGrid

<!DOCTYPE html>
<html>
<head>
    <title>BasicRallyGrid</title>

    <script type="text/javascript" src="/apps/2.0rc2/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
                // Custom Rally App that displays Stories in a grid.
//
// Note: various console debugging messages intentionally kept in the code for learning purposes

Ext.define('CustomApp', {
    extend: 'Rally.app.App',      // The parent class manages the app 'lifecycle' and calls launch() when ready
    componentCls: 'app',          // CSS styles found in app.css

    // Entry Point to App
    launch: function() {

      console.log('our first app');     // see console api: https://developers.google.com/chrome-developer-tools/docs/console-api
      this._loadData();                 // we need to prefix with 'this.' so we call a method found at the app level.
    },

    // Get data from Rally
    _loadData: function() {

      var myStore = Ext.create('Rally.data.wsapi.Store', {
          model: 'PortfolioItem',
          autoLoad: true,                         // <----- Don't forget to set this to true! heh
          listeners: {
              load: function(myStore, myData, success) {
                  console.log('got data!', myStore, myData);
                  this._loadGrid(myStore);      // if we did NOT pass scope:this below, this line would be incorrectly trying to call _createGrid() on the store which does not exist.
              },
              scope: this                         // This tells the wsapi data store to forward pass along the app-level context into ALL listener functions
          },
          fetch: ['Executive Champion', 'Name', 'ScheduleState']   // Look in the WSAPI docs online to see all fields available!
        });

    },

    // Create and Show a Grid of given stories
    _loadGrid: function(myStoryStore) {

      var myGrid = Ext.create('Rally.ui.grid.Grid', {
        store: myStoryStore,
        columnCfgs: [         
          'Executive Champion', 'Name', 'ScheduleState'
        ]
      });

      this.add(myGrid);       

      console.log('what is this?', this);

    }

});


            Rally.launchApp('CustomApp', {
                name:"BasicRallyGrid",
                parentRepos:""
            });

        });
    </script>


    <style type="text/css">
        .app {
     /* Add app styles here */
}

    </style>
</head>
<body></body>
</html>

1 个答案:

答案 0 :(得分:0)

当然可以在网格中显示PI自定义字段值。 即使您的自定义字段在DisplayName中有空格,也要从代码中的“Executive Champion”中删除空格。

这是一个例子。我在项目组合项目对象上有一个自定义字段,显示在Setup&gt; Workspaces&amp;项目如下:

姓名:PiCustom

DisplayName:PiCustom

需要工作区管理员权限才能看到该页面。

WS API将此字段引用为c_PiCustom(c_自动预先添加以指示自定义字段)

在我的代码中,任何一个都可以正常工作:  PiCustomc_PiCustom

如果工作区管理员更改此自定义字段的DisplayName以包含空格,如下所示:

姓名:PiCustom

DisplayName:Pi Custom

它仍会在WS API

中显示为c_PiCustom

在我的代码中引用此字段的两种方法之一仍然有效: PiCustomc_PiCustom

Pi Custom无效。

删除代码中的空格。或者在WS API中检查该字段的确切拼写并遵循该约定。

以下是使用2.0rc3的完整示例:

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    launch: function() {
                this.add({
                    xtype: 'rallygrid',
                    model: 'PortfolioItem/Feature',
                    enableRanking: true,
                    storeConfig: {
                      context: {
                          context: this.getContext().getDataContext()
                      }
                    },
                   {
                        dataIndex: 'FormattedID'
                    },{
                        dataIndex: 'Name',
                    },
                     {
                        dataIndex: 'PiCustom'
                    }
                    ]
                });
    }
});