@@ -13,7 +13,8 @@ Ext.define("custom-grid-with-deep-export", {
1313 query : '' ,
1414 showControls : true ,
1515 type : 'HierarchicalRequirement' ,
16- pageSize : 50
16+ pageSize : 50 ,
17+ searchAllProjects : [ { checked : false } ] ,
1718 }
1819 } ,
1920
@@ -51,12 +52,17 @@ Ext.define("custom-grid-with-deep-export", {
5152 this . modelNames = [ this . getSetting ( 'type' ) ] ;
5253 this . logger . log ( '_buildStore' , this . modelNames ) ;
5354 var fetch = [ 'FormattedID' , 'Name' ] ;
55+ var dataContext = this . getContext ( ) . getDataContext ( ) ;
56+ if ( this . searchAllProjects ( ) ) {
57+ dataContext . project = null ;
58+ }
5459
5560 Ext . create ( 'Rally.data.wsapi.TreeStoreBuilder' ) . build ( {
5661 models : this . modelNames ,
5762 enableHierarchy : true ,
5863 remoteSort : true ,
59- fetch : fetch
64+ fetch : fetch ,
65+ context : dataContext
6066 } ) . then ( {
6167 success : this . _addGridboard ,
6268 scope : this
@@ -75,10 +81,14 @@ Ext.define("custom-grid-with-deep-export", {
7581 }
7682 this . logger . log ( '_addGridboard' , store ) ;
7783
78-
84+ var context = this . getContext ( ) ;
85+ var dataContext = context . getDataContext ( ) ;
86+ if ( this . searchAllProjects ( ) ) {
87+ dataContext . project = null ;
88+ }
7989 this . gridboard = this . down ( '#display_box' ) . add ( {
8090 xtype : 'rallygridboard' ,
81- context : this . getContext ( ) ,
91+ context : context ,
8292 modelNames : this . modelNames ,
8393 toggleState : 'grid' ,
8494 plugins : [
@@ -126,7 +136,8 @@ Ext.define("custom-grid-with-deep-export", {
126136 gridConfig : {
127137 store : store ,
128138 storeConfig : {
129- filters : filters
139+ filters : filters ,
140+ context : dataContext
130141 } ,
131142 columnCfgs : [
132143 'Name'
@@ -266,14 +277,18 @@ Ext.define("custom-grid-with-deep-export", {
266277 exporter . on ( 'exporterror' , this . _showError , this ) ;
267278 exporter . on ( 'exportcomplete' , this . _showStatus , this ) ;
268279
280+ var dataContext = this . getContext ( ) . getDataContext ( ) ;
281+ if ( this . searchAllProjects ( ) ) {
282+ dataContext . project = null ;
283+ }
269284 var hierarchyLoader = Ext . create ( 'Rally.technicalservices.HierarchyLoader' , {
270285 model : modelName ,
271286 fetch : fetch ,
272287 filters : filters ,
273288 sorters : sorters ,
274289 loadChildModels : childModels ,
275290 portfolioItemTypes : this . portfolioItemTypes ,
276- context : this . getContext ( ) . getDataContext ( )
291+ context : dataContext
277292 } ) ;
278293 hierarchyLoader . on ( 'statusupdate' , this . _showStatus , this ) ;
279294 hierarchyLoader . on ( 'hierarchyloadartifactsloaded' , exporter . setRecords , exporter ) ;
@@ -315,8 +330,26 @@ Ext.define("custom-grid-with-deep-export", {
315330 isExternal : function ( ) {
316331 return typeof ( this . getAppId ( ) ) == 'undefined' ;
317332 } ,
333+
334+ isMilestoneScoped : function ( ) {
335+ var result = false ;
336+
337+ var tbscope = this . getContext ( ) . getTimeboxScope ( ) ;
338+ if ( tbscope && tbscope . getType ( ) == 'milestone' ) {
339+ result = true ;
340+ }
341+ return result
342+ } ,
343+
344+ searchAllProjects : function ( ) {
345+ var searchAllProjects = this . getSetting ( 'searchAllProjects' ) ;
346+ return this . isMilestoneScoped ( ) && searchAllProjects ;
347+ } ,
348+
318349 getSettingsFields : function ( ) {
319- return Rally . technicalservices . CustomGridWithDeepExportSettings . getFields ( ) ;
350+ return Rally . technicalservices . CustomGridWithDeepExportSettings . getFields ( {
351+ showSearchAllProjects : this . isMilestoneScoped ( )
352+ } ) ;
320353 } ,
321354 //onSettingsUpdate: Override
322355 onSettingsUpdate : function ( settings ) {
0 commit comments