diff --git a/deploy/App.txt b/deploy/App.txt index 1fbd695..c5c64be 100644 --- a/deploy/App.txt +++ b/deploy/App.txt @@ -3,11 +3,11 @@ Custom Grid with Deep Export - + @@ -877,6 +877,11 @@ Ext.define("custom-grid-with-deep-export", { allowExpansionStateToBeSaved: false, enableAddNew: true, + onTimeboxScopeChange: function(newTimeboxScope) { + this.callParent(arguments); + this._buildStore(); + }, + launch: function () { this.fetchPortfolioItemTypes().then({ success: function(portfolioItemTypes){ @@ -912,7 +917,11 @@ Ext.define("custom-grid-with-deep-export", { this.down('#display_box').removeAll(); } - var filters = this.getSetting('query') ? Rally.data.wsapi.Filter.fromQueryString(this.getSetting('query')) : []; + var filters = this.getSetting('query') ? [Rally.data.wsapi.Filter.fromQueryString(this.getSetting('query'))] : []; + var timeboxScope = this.getContext().getTimeboxScope(); + if (timeboxScope && timeboxScope.isApplicable(store.model)) { + filters.push(timeboxScope.getQueryFilter()); + } this.logger.log('_addGridboard', store); @@ -1055,12 +1064,14 @@ Ext.define("custom-grid-with-deep-export", { if (grid.currentCustomFilter && grid.currentCustomFilter.filters){ filters = grid.currentCustomFilter.filters; } - if (query){ - if (filters && filters.length > 0){ - return filters.and(filters, Rally.data.wsapi.Filter.fromQueryString(query)); - } else { - return Rally.data.wsapi.Filter.fromQueryString(query); - } + + if (query) { + filters.push(Rally.data.wsapi.Filter.fromQueryString(query)); + } + + var timeboxScope = this.getContext().getTimeboxScope(); + if (timeboxScope && timeboxScope.isApplicable(grid.getGridOrBoard().store.model)) { + filters.push(timeboxScope.getQueryFilter()); } return filters; }, diff --git a/package-lock.json b/package-lock.json index 1577409..b942999 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "custom-grid-with-deep-export", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c80686d..2f3f9cc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "_comment": "This file is used by grunt", "name": "custom-grid-with-deep-export", - "version": "1.1.2", + "version": "1.1.3", "dependencies": {}, "devDependencies": { "grunt": "~0.4.1", diff --git a/src/javascript/app.js b/src/javascript/app.js index dd35ad2..7f8044e 100644 --- a/src/javascript/app.js +++ b/src/javascript/app.js @@ -29,6 +29,11 @@ Ext.define("custom-grid-with-deep-export", { allowExpansionStateToBeSaved: false, enableAddNew: true, + onTimeboxScopeChange: function(newTimeboxScope) { + this.callParent(arguments); + this._buildStore(); + }, + launch: function () { this.fetchPortfolioItemTypes().then({ success: function(portfolioItemTypes){ @@ -64,7 +69,11 @@ Ext.define("custom-grid-with-deep-export", { this.down('#display_box').removeAll(); } - var filters = this.getSetting('query') ? Rally.data.wsapi.Filter.fromQueryString(this.getSetting('query')) : []; + var filters = this.getSetting('query') ? [Rally.data.wsapi.Filter.fromQueryString(this.getSetting('query'))] : []; + var timeboxScope = this.getContext().getTimeboxScope(); + if (timeboxScope && timeboxScope.isApplicable(store.model)) { + filters.push(timeboxScope.getQueryFilter()); + } this.logger.log('_addGridboard', store); @@ -207,12 +216,14 @@ Ext.define("custom-grid-with-deep-export", { if (grid.currentCustomFilter && grid.currentCustomFilter.filters){ filters = grid.currentCustomFilter.filters; } - if (query){ - if (filters && filters.length > 0){ - return filters.and(filters, Rally.data.wsapi.Filter.fromQueryString(query)); - } else { - return Rally.data.wsapi.Filter.fromQueryString(query); - } + + if (query) { + filters.push(Rally.data.wsapi.Filter.fromQueryString(query)); + } + + var timeboxScope = this.getContext().getTimeboxScope(); + if (timeboxScope && timeboxScope.isApplicable(grid.getGridOrBoard().store.model)) { + filters.push(timeboxScope.getQueryFilter()); } return filters; },