From 534c188d25524fa1db918e09e1ab6faa18e5d7a2 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 22 Mar 2021 11:09:41 -0600 Subject: [PATCH] Put selected columns into nextmatch value so columns are saved in favourites --- api/js/etemplate/et2_extension_nextmatch.js | 6 +++++- api/js/etemplate/et2_extension_nextmatch.ts | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index a6e008fe16..d3ac1241d1 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1101,7 +1101,7 @@ var et2_nextmatch = /** @class */ (function (_super) { jQuery.merge(colDisplay, custom_fields); // Update query value, so data source can use visible columns to exclude expensive sub-queries var oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : []; - this.activeFilters.selectcols = this.sortedColumnsList ? this.sortedColumnsList : colDisplay; + this.activeFilters.selectcols = this.sortedColumnsList.length > 0 ? this.sortedColumnsList : colDisplay; // We don't need to re-query if they've removed a column var changed = []; ColLoop: for (var i = 0; i < colDisplay.length; i++) { @@ -2017,6 +2017,10 @@ var et2_nextmatch = /** @class */ (function (_super) { col_filter: {} }; jQuery.extend(value, this.activeFilters, this.value); + if (typeof value.selectcols == "undefined" || value.selectcols.length === 0) { + this._updateUserPreferences(); + value.selectcols = this.activeFilters.selectcols; + } return value; }; et2_nextmatch.prototype.resetDirty = function () { }; diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index e645ab8f48..66ae56d587 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -1530,7 +1530,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 // Update query value, so data source can use visible columns to exclude expensive sub-queries const oldCols = this.activeFilters.selectcols ? this.activeFilters.selectcols : []; - this.activeFilters.selectcols = this.sortedColumnsList ? this.sortedColumnsList : colDisplay; + this.activeFilters.selectcols = this.sortedColumnsList.length > 0 ? this.sortedColumnsList : colDisplay; // We don't need to re-query if they've removed a column const changed = []; @@ -2721,6 +2721,12 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 col_filter: {} }; jQuery.extend(value, this.activeFilters, this.value); + + if(typeof value.selectcols == "undefined" || value.selectcols.length === 0) + { + this._updateUserPreferences(); + value.selectcols = this.activeFilters.selectcols; + } return value; } resetDirty( )