@@ -7,6 +7,14 @@ Ext.define("custom-grid-with-deep-export", {
77 align : 'stretch'
88 } ,
99 items : [ {
10+ id : Utils . AncestorPiAppFilter . RENDER_AREA_ID ,
11+ xtype : 'container' ,
12+ layout : {
13+ type : 'hbox' ,
14+ align : 'middle' ,
15+ defaultMargins : '0 10 10 0' ,
16+ }
17+ } , {
1018 id : 'grid-area' ,
1119 xtype : 'container' ,
1220 flex : 1 ,
@@ -40,22 +48,37 @@ Ext.define("custom-grid-with-deep-export", {
4048 this . _buildStore ( ) ;
4149 } ,
4250 launch : function ( ) {
43- Rally . data . util . PortfolioItemHelper . getPortfolioItemTypes ( )
44- . then ( {
45- success : function ( portfolioItemTypes ) {
46- this . portfolioItemTypes = _ . sortBy ( portfolioItemTypes , function ( type ) {
47- return type . get ( 'Ordinal' ) ;
48- } ) ;
49- this . _buildStore ( ) ;
50- } ,
51- failure : function ( msg ) {
52- this . _showError ( msg ) ;
51+ this . ancestorFilterPlugin = Ext . create ( 'Utils.AncestorPiAppFilter' , {
52+ ptype : 'UtilsAncestorPiAppFilter' ,
53+ pluginId : 'ancestorFilterPlugin' ,
54+ settingsConfig : {
55+ //labelWidth: 150,
56+ //margin: 10
57+ } ,
58+ listeners : {
59+ scope : this ,
60+ ready : function ( plugin ) {
61+ Rally . data . util . PortfolioItemHelper . getPortfolioItemTypes ( ) . then ( {
62+ scope : this ,
63+ success : function ( portfolioItemTypes ) {
64+ this . portfolioItemTypes = _ . sortBy ( portfolioItemTypes , function ( type ) {
65+ return type . get ( 'Ordinal' ) ;
66+ } ) ;
67+
68+ plugin . addListener ( {
69+ scope : this ,
70+ select : this . viewChange
71+ } ) ;
72+ this . viewChange ( ) ;
73+ } ,
74+ failure : function ( msg ) {
75+ this . _showError ( msg ) ;
76+ } ,
77+ } )
5378 } ,
54- scope : this
55- } ) ;
56- var listenerConfig = {
57- scope : this
58- }
79+ }
80+ } ) ;
81+ this . addPlugin ( this . ancestorFilterPlugin ) ;
5982 } ,
6083
6184 // Usual monkey business to size gridboards
@@ -93,11 +116,17 @@ Ext.define("custom-grid-with-deep-export", {
93116 var gridArea = this . down ( '#grid-area' )
94117 gridArea . removeAll ( ) ;
95118
119+ var currentModelName = this . modelNames [ 0 ] ;
120+
96121 var filters = this . getSetting ( 'query' ) ? [ Rally . data . wsapi . Filter . fromQueryString ( this . getSetting ( 'query' ) ) ] : [ ] ;
97122 var timeboxScope = this . getContext ( ) . getTimeboxScope ( ) ;
98123 if ( timeboxScope && timeboxScope . isApplicable ( store . model ) ) {
99124 filters . push ( timeboxScope . getQueryFilter ( ) ) ;
100125 }
126+ var ancestorFilter = this . ancestorFilterPlugin . getFilterForType ( currentModelName ) ;
127+ if ( ancestorFilter ) {
128+ filters . push ( ancestorFilter ) ;
129+ }
101130 this . logger . log ( '_addGridboard' , store ) ;
102131
103132 var context = this . getContext ( ) ;
@@ -106,7 +135,6 @@ Ext.define("custom-grid-with-deep-export", {
106135 dataContext . project = null ;
107136 }
108137 var summaryRowFeature = Ext . create ( 'Rally.ui.grid.feature.SummaryRow' ) ;
109- var currentModelName = this . modelNames [ 0 ] ;
110138 this . gridboard = gridArea . add ( {
111139 xtype : 'rallygridboard' ,
112140 context : context ,
0 commit comments