0

アーティファクトの特定のプロパティが持つことができる属性をコンボボックスに動的に入力する方法はありますか?

例えば

ユーザー ストーリーにカスタム フィールドを設定しました。ハードコーディングせずに、このカスタム フィールドのすべての可能な値をコンボボックスに入力できるようにしたいと考えています。

4

1 に答える 1

0

以下のコードでは、ドロップダウン タイプのカスタム フィールドの許容値がコンボボックスに自動的に取り込まれます。

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

                items: [
                    {
                        xtype: 'container',
                        itemId: 'kbFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'grid',
                        width: 800
                    }
                ],

                launch: function() {
                    this.down('#kbFilter').add({
                        xtype: 'checkbox',
                        cls: 'filter',
                        boxLabel: 'Filter table by custom field',
                        id: 'kbCheckbox',
                        scope: this,
                        handler: this._onSettingsChange
                    });

                    this.down('#kbFilter').add({
                        xtype: 'rallyattributecombobox',
                        cls: 'filter',
                        model: 'Defect',
                        field: 'MyKB',                                    
                        listeners: {
                            ready: this._onKBComboBoxLoad,
                            select: this._onKBComboBoxSelect,
                            scope: this
                        }
                    });
                },


                _onKBComboBoxLoad: function(comboBox) {
                    this.kbComboBox = comboBox;

                    Rally.data.ModelFactory.getModel({
                        type: 'Defect',
                        success: this._onModelRetrieved,
                        scope: this
                    });
                },

                _getFilter: function() {
                    var filter = [];

                    if (Ext.getCmp('kbCheckbox').getValue()) {
                        filter.push({
                            property: 'MyKB',                                 
                            operator: '=',
                            value: this.kbComboBox.getValue()
                        });
                    }
                    return filter;
                },

                _onKBComboBoxSelect: function() {
                    if (Ext.getCmp('kbCheckbox').getValue()) {
                        this._onSettingsChange();
                    }
                },
                _onSettingsChange: function() {
                    this.grid.filter(this._getFilter(), true, true);
                },

                _onModelRetrieved: function(model) {
                    this.grid = this.down('#grid').add({
                        xtype: 'rallygrid',
                        model: model,
                        columnCfgs: [
                            'FormattedID',
                            'Name',
                            'MyKB'                 
                        ],
                        storeConfig: {
                            context: this.context.getDataContext(),
                            filters: this._getFilter()
                        },
                        showPagingToolbar: false
                    });
                }
            });

この例では、名前: myKB と表示名: My KB のドロップダウン フィールドがあります。WS API では、c_myKB のように、名前の前に c_ が追加されて表示されます。ただし、c_myKB を使用すると、次のエラーが表示されます。

Uncaught Rally.ui.combobox.FieldValueComboBox._populateStore(): field config must be specified when creating a Rally.ui.combobox.FieldValueComboBox

フィールドの表示名をスペースなしで使用します。このアプリの動作を示すスクリーンショットを次に示します。 ここに画像の説明を入力

于 2013-09-03T19:20:28.000 に答える