1

当一个字段在 Rally 中“隐藏”时,它们将不会显示在任何 SDK 的 UI 组件中。例如,我不能rallygrid用 dataIndex 的列创建一个,_ref因为_ref它是一个隐藏字段。我也有隐藏的自定义字段,但我真的需要使用它们在rallygrid.

我查看了 sdk 源代码并知道这些已从 SDK 的 ui 组件中删除,所以我想我正在寻找一种解决方法,或者解决这个问题的 hack。

我在这里评论了这个问题

4

1 回答 1

1

可以在基于自定义存储的网格中包含 _ref 。我修改了一个自定义数据网格示例,用每条记录的 _ref 值填充参考列:

在此处输入图像描述

Ext.define('CustomApp', {
    extend: 'Rally.app.App',
    componentCls: 'app',
    items:{ html:'<a href="https://help.rallydev.com/apps/2.0rc3/doc/">App SDK 2.0rc3 Docs</a>'},
    launch: function() {
        Ext.create('Rally.data.wsapi.Store', {
            model: 'userstory',
            autoLoad: true,
            listeners:{
                load: this._onDataLoaded,
                scope: this
            },
            fetch: ['FormattedID', 'Name', '_ref']
        })
    },
    _onDataLoaded: function(store,data){
        var records = _.map(data, function(record){
            return Ext.apply({
                Ref: record.get('_ref')
            }, record.getData());
        });
        this.add({
            xtype: 'rallygrid',
            showPagingToolbar: false,
            showRowActionsColumn: false,
            editable: false,
            store: Ext.create('Rally.data.custom.Store', {
                data: records
            }),
            columnCfgs:[
                {
                    xtype: 'templatecolumn',
                    text: 'ID',
                    dataIndex: 'FormattedID',
                    width: 100,
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },
                {
                    text: 'Name',
                    dataIndex: 'Name'
                },
                {
                    text: 'Reference',
                    dataIndex: 'Ref',
                    flex: 1
                }
            ]
        })
    }
});
于 2014-07-20T21:30:42.547 回答