ComboBox中的拉力自定义字段显示?

时间:2014-04-29 15:33:11

标签: rally

我试图在组合框中填充自定义字段值并且在执行此操作时遇到了麻烦,这与像(状态,所有者等)的集会字段不同。

我可以在实施方面找到方向吗?

注意:我正试图在sharepoint外的拉力赛中运行此应用程序。

代码段:

<script type="text/javascript">
        Rally.onReady(function() {
            Ext.define('CustomApp', {
                extend: 'Rally.app.App',
                componentCls: 'app',

                items: [
                    {
                        xtype: 'container',
                        itemId: 'stateFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'ownerFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'releaseFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'qdpPriorityFilter'
                    },
                    {
                        xtype: 'container',
                        itemId: 'grid',
                    }
                ],

                launch: function() {
                    this.down('#ownerFilter').add({
                        xtype: 'checkbox',
                        cls: 'filter',
                        boxLabel: 'Filter table by Owner',
                        id: 'ownerCheckbox',
                        scope: this,
                        handler: this._onSettingsChange
                    });

                    this.down('#ownerFilter').add({
                        xtype: 'rallyfieldvaluecombobox',
                        cls: 'filter',
                        model: 'PortfolioItem/MinimalReleasableFeature',
                        field: 'Owner',
                        listeners: {
                            ready: this._onOwnerComboBoxLoad,
                            select: this._onOwnerComboBoxSelect,
                            scope: this
                        }
                    });
                },

                _onOwnerComboBoxLoad: function(comboBox) {
                    this.ownerComboBox = comboBox;

                    this.down('#releaseFilter').add({
                        xtype: 'checkbox',
                        cls: 'filter',
                        boxLabel: 'Filter table by Release',
                        id: 'releaseCheckbox',
                        scope: this,
                        handler: this._onSettingsChange
                    });

                    this.down('#releaseFilter').add({
                        xtype: 'rallyfieldvaluecombobox',
                        cls: 'filter',
                        model: 'PortfolioItem/MinimalReleasableFeature',
                        field: 'Release',
                        listeners: {
                            ready: this._onReleaseComboBoxLoad,
                            select: this._onReleaseComboBoxSelect,
                            scope: this
                        }
                    });
                },

                _onReleaseComboBoxLoad: function(comboBox) {
                    this.releaseComboBox = comboBox;

                    this.down('#stateFilter').add({
                        xtype: 'checkbox',
                        cls: 'filter',
                        boxLabel: 'Filter table by State',
                        id: 'stateCheckbox',
                        scope: this,
                        handler: this._onSettingsChange
                    });

                    this.down('#stateFilter').add({
                        xtype: 'rallyfieldvaluecombobox',
                        cls: 'filter',
                        model: 'PortfolioItem/MinimalReleasableFeature',
                        field: 'State',
                        listeners: {
                            ready: this._onStateComboBoxLoad,
                            select: this._onStateComboBoxSelect,
                            scope: this
                        }
                    });


                },

                _onStateComboBoxLoad: function(comboBox) {
                    this.stateComboBox = comboBox;

                    this.down('#qdpPriorityFilter').add({
                        xtype: 'checkbox',
                        cls: 'filter',
                        boxLabel: 'Filter table by QDPPriority',
                        id: 'qdpPriorityCheckbox',
                        scope: this,
                        handler: this._onSettingsChange
                    });

                    this.down('#qdpPriorityFilter').add({
                        xtype: 'rallyfieldvaluecombobox',
                        cls: 'filter',
                        model: 'PortfolioItem/MinimalReleasableFeature',
                        field: 'c_QDPPriority',
                        forceSelection:'false',
                        listeners: {
                            ready: this._onQdpPriorityComboBoxLoad,
                            select: this._onQdpPriorityComboBoxSelect,
                            scope: this
                        }
                    });

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

                },


                 _onQdpPriorityComboBoxLoad: function(comboBox) {
                    this.qdpPriorityComboBox = comboBox;

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

                 },

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

                    if (Ext.getCmp('ownerCheckbox').getValue()) {
                        filter.push({
                            property: 'Owner',
                            operator: '=',
                            value: this.ownerComboBox.getValue()
                        });
                    }

                    if (Ext.getCmp('releaseCheckbox').getValue()) {
                        filter.push({
                            property: 'Release',
                            operator: '=',
                            value: this.releaseComboBox.getValue()
                        });
                    }

                     if (Ext.getCmp('stateCheckbox').getValue()) {
                        filter.push({
                            property: 'State',
                            operator: '=',
                            value: this.stateComboBox.getValue()
                        });
                    }

                     if (Ext.getCmp('qdpPriorityCheckbox').getValue()) {
                        filter.push({
                            property: 'c_QDPPriority',
                            operator: '=',
                            value: this.qdpPriorityComboBox.getValueField( )
                        });
                    }


                    return filter;
                },

                _onOwnerComboBoxSelect: function() {
                    if (Ext.getCmp('ownerCheckbox').getValue()) {
                        this._onSettingsChange();
                    }
                },

                _onReleaseComboBoxSelect: function() {
                    if (Ext.getCmp('releaseCheckbox').getValue()) {
                        this._onSettingsChange();
                    }
                },

                 _onStateComboBoxSelect: function() {
                    if (Ext.getCmp('stateCheckbox').getValue()) {
                        this._onSettingsChange();
                    }
                },

                _onQdpPriorityComboBoxSelect: function() {
                    if (Ext.getCmp('qdpPriorityCheckbox').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',
                                    'DragAndDropRank',
                                    'Owner',
                                    'State',
                                    'c_QDPPriority',
                                    'c_QDPPointsApproved',
                                    'Owner',
                                    'Release',
                                    'c_PreliminaryEst',
                                    'PercentDoneByStoryPlanEstimate',
                                    'c_CAIRRequest',
                                    'InvestmentCategory'
                        ],
                        storeConfig: {
                            context: this.context.getDataContext(),
                            filters: this._getFilter()
                        },
                        showPagingToolbar: false
                    });
                }
            });


            Rally.launchApp('CustomApp', {
              name: 'QDP Readiness Dashboard'
            });
        });
    </script>

1 个答案:

答案 0 :(得分:0)

以下是基于自定义看板字段MyKB的示例。完整的应用程序位于this github repo.

 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
                    });
                }
            });