Merge pull request #84 from asig2016/19.1_dont_update_nm_preference_on_empty_selectcols

Save preferences for selected columns and their sizes only if "select…
This commit is contained in:
Nathan Gray 2020-04-09 12:28:52 -06:00 committed by GitHub
commit b6020ad9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(egw().lang("Saved column sizes to preferences."));
}
// 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