From c5abd85836ca9f153f4ec011ff8645093ce44ee4 Mon Sep 17 00:00:00 2001 From: Alexandros Sigalas Date: Sun, 5 Apr 2020 15:29:34 +0300 Subject: [PATCH 1/2] Save preferences for selected columns and their sizes only if "selectcols" is not empty. --- api/js/etemplate/et2_extension_nextmatch.js | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 4c32b8475a..479ae2daa5 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1063,16 +1063,18 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_ // 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 - this.egw().set_preference(app, pref+"-size", colSize); + // 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('Saved column sizes to prefences.'); + } // 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 From f224c3e0387d8d929231a3c3b69b2df23635885d Mon Sep 17 00:00:00 2001 From: Alexandros Sigalas Date: Sun, 5 Apr 2020 15:41:51 +0300 Subject: [PATCH 2/2] Fixed typo, added lang --- api/js/etemplate/et2_extension_nextmatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 479ae2daa5..16f878867c 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -1073,7 +1073,7 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_ ); // Save adjusted column sizes and inform user about it this.egw().set_preference(app, pref+"-size", colSize); - this.egw().message('Saved column sizes to prefences.'); + this.egw().message(egw().lang("Saved column sizes to preferences.")); } // No significant change (just normal columns shown) and no need to wait,