From bac1ff5a1de0afd65b0a6c4042883610441f3701 Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 9 Apr 2020 12:39:16 -0600 Subject: [PATCH] Port b6020ad from asig2016 to master --- api/js/etemplate/et2_extension_nextmatch.js | 20 ++++++++++++-------- api/js/etemplate/et2_extension_nextmatch.ts | 20 ++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 2df54b45b1..786d55d327 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -847,14 +847,18 @@ var et2_nextmatch = /** @class */ (function (_super) { // If a custom field column was added, throw away cache to deal with // efficient apps that didn't send all custom fields in the first request var cf_added = jQuery(changed).filter(jQuery(custom_fields)).length > 0; - // Save visible columns - // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in - this.egw().set_preference(app, pref, this.activeFilters.selectcols.join(","), - // Use callback after the preference gets set to trigger refresh, in case app - // isn't looking at selectcols and just uses preference - cf_added ? jQuery.proxy(function () { if (this.controller) - this.controller.update(true); }, this) : null); - // Save adjusted column sizes + // Save visible columns and sizes if selectcols is not emtpy (an empty selectcols actually deletes the prefrence) + if (!jQuery.isEmptyObject(this.activeFilters.selectcols)) { + // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in + this.egw().set_preference(app, pref, this.activeFilters.selectcols.join(","), + // Use callback after the preference gets set to trigger refresh, in case app + // isn't looking at selectcols and just uses preference + cf_added ? jQuery.proxy(function () { if (this.controller) + this.controller.update(true); }, this) : null); + // Save adjusted column sizes and inform user about it + this.egw().set_preference(app, pref + "-size", colSize); + this.egw().message(this.egw().lang("Saved column sizes to preferences.")); + } this.egw().set_preference(app, pref + "-size", colSize); // No significant change (just normal columns shown) and no need to wait, // but the grid still needs to be redrawn if a custom field was removed because diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index ee810216d1..4158dd5566 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -1186,15 +1186,19 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 // efficient apps that didn't send all custom fields in the first request const cf_added = jQuery(changed).filter(jQuery(custom_fields)).length > 0; - // Save visible columns - // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in - this.egw().set_preference(app, pref, this.activeFilters.selectcols.join(","), - // Use callback after the preference gets set to trigger refresh, in case app - // isn't looking at selectcols and just uses preference + // Save visible columns and sizes if selectcols is not emtpy (an empty selectcols actually deletes the prefrence) + if(!jQuery.isEmptyObject(this.activeFilters.selectcols)) + { + // 'nextmatch-' prefix is there in preference name, but not in setting, so add it in + this.egw().set_preference(app, pref, this.activeFilters.selectcols.join(","), + // Use callback after the preference gets set to trigger refresh, in case app + // isn't looking at selectcols and just uses preference cf_added ? jQuery.proxy(function() {if(this.controller) this.controller.update(true);}, this):null - ); - - // Save adjusted column sizes + ); + // Save adjusted column sizes and inform user about it + this.egw().set_preference(app, pref+"-size", colSize); + this.egw().message(this.egw().lang("Saved column sizes to preferences.")); + } this.egw().set_preference(app, pref+"-size", colSize); // No significant change (just normal columns shown) and no need to wait,