根据为CardBoard选择的PortfolioItem过滤卡片

时间:2015-01-16 12:35:12

标签: extjs rally extjs4.2

我正在创建一个拉力赛sdk2应用程序,它显示了像MMF,Epic和Program这样的PortfolioItems的Rally.ui.dialog.ChooserDialog 选择多个MMF或Epics或程序时,请根据这些过滤器显示功能,但不会显示卡。我无法弄明白的东西。 下面是我的一些代码

        Ext.define('CustomApp', {
            extend: 'Rally.app.App',
            componentCls: 'app',
            items:[{ xtype: 'container', itemId: 'filter_box', padding: 5},{xtype:'container',itemId:'button_box',layout:{type:'hbox'}, padding: 10}],              
            logger: new Rally.technicalservices.logger(),
            launch: function() {
                this.down('#button_box').add({
                    xtype: 'rallybutton',
                    text: 'Filter',
                    itemId: 'run-button',
                    scope: this,
                    handler: this._run,
                    margin: '0 10 0 95'
                });

            },
            _drawCardBoard: function(records){
                var filters = null;
                alert("hi there");
                console.log("context");
                var me = this;
                if (records[0].data.PortfolioItemTypeName == "MMF") {
                    console.log("context name", records[0].data.FormattedID);
                    filters = Ext.create('Rally.data.QueryFilter',{
                        property: 'Parent.FormattedID',
                        operator: '=',
                        value: records[0].data.FormattedID
                    });
                } else if (records[0].data.PortfolioItemTypeName == "Epic") {
                    filters = Ext.create('Rally.data.QueryFilter',{
                        property: 'Parent.Parent.FormattedID',
                        operator: '=',
                        value: records[0].data.FormattedID
                    }); 
                } else if (records[0].data.PortfolioItemTypeName == "Program") {
                    filters = Ext.create('Rally.data.QueryFilter',{
                        property: 'Parent.Parent.Parent.FormattedID',
                        operator: '=',
                        value: records[0].data.FormattedID
                    });                     
                }   
                if (records.length > 1) {
                    for ( var i=1;i<records.length;i++ ) {
                        if (records[i].data.PortfolioItemTypeName == "MMF") {
                            console.log("context name 2", records[i].data.FormattedID);
                            filters = filters.or(Ext.create('Rally.data.QueryFilter',{
                                property: 'Parent.FormattedID',
                                operator: '=',
                                value: records[i].data.FormattedID
                            }));
                        } else if (records[i].data.PortfolioItemTypeName == "Epic") {   
                            filters = filters.or(Ext.create('Rally.data.QueryFilter',{
                                property: 'Parent.Parent.FormattedID',
                                operator: '=',
                                value: records[i].data.FormattedID
                            }));                                
                        } else if (records[i].data.PortfolioItemTypeName == "Program") {    
                            filters = filters.or(Ext.create('Rally.data.QueryFilter',{
                                property: 'Parent.Parent.Parent.FormattedID',
                                operator: '=',
                                value: records[i].data.FormattedID
                            }));    
                        }       
                    }
                }   
                console.log("filters values", filters.toString());
                this.cardboard = Ext.create('Rally.ui.cardboard.CardBoard',{
                    types: ['PortfolioItem/Feature'],
                    attribute: 'Release',
                    columnConfig: {
                        xtype: 'rallycardboardcolumn',
                        displayField: 'Name',
                        valueField: '_ref',
                        plugins: [
                            {ptype:'rallycolumndropcontroller'},
                            {ptype:'rallycardboardcardrecordprocessor'},
                            {ptype:'tscolumnheaderupdater'}  /*,
                            {ptype:'tscolumnheaderupdater', field_to_aggregate: 'LeafStoryPlanEstimateTotal'}*/
                        ],
                    },
                    storeConfig: { 
                        filters: filters,
                        context: this.getContext().getDataContext()
                    },                              
                    cardConfig: {
                        showIconsAndHighlightBorder: false,                      
                        fields: [
                            'FormattedID',
                            'Name',
                            'Parent',
                            'ReleaseDate',
                            'ReleaseStartDate',
                            { name: 'Project', renderer: me._renderProject },
                            { name: 'PercentDoneByStoryPlanEstimate' },
                            { name: 'c_FeatureEstimate', fetch: ['c_FeatureEstimate'] }
                        ],
                        listeners: {
                            added: function(card,container){
                                me.logger.log(this,card,container);
                            },
                            fieldClick: function(eOpts) {
                                me.logger.log(this,eOpts);
                                if ( eOpts == "PercentDoneByStoryPlanEstimate" ) {
                                    me._showDoneTooltip(eOpts,this);
                                }
                            }
                        }
                    }
                });
                _run: function() {
                    this._parents = {};
                    var me = this;
                    Ext.create('Rally.ui.dialog.ChooserDialog', {
                        width: 470,
                        autoScroll: true,
                        height: 500,
                        title: 'Select to Filter',
                        pageSize: 100,
                        closable: false,
                        selectionButtonText: 'Filter',   
                        multiple: true, 
                        artifactTypes: ['PortfolioItem/MMF','PortfolioItem/Epic', 'PortfolioItem/Program'],
                        autoShow: true,
                        storeConfig:{
                            fetch: ['Name','PortfolioItemTypeName', 'Parent']
                        },
                        listeners: {
                            scope: me,
                            artifactChosen: function(selectedRecord) {
                                console.log("selectedRecord", selectedRecord);
                                me._drawCardBoard(selectedRecord);
                            }
                        }
                    });
                },                  

0 个答案:

没有答案