Api: Stop annoying "column saved" message that kept coming up

This commit is contained in:
nathangray 2021-03-24 10:21:02 -06:00
parent d422c5ad62
commit 1a94a0ef98
4 changed files with 80 additions and 8 deletions

View File

@ -1558,6 +1558,39 @@ var et2_nextmatch = /** @class */ (function (_super) {
this.selectPopup.css("top", t_position.top)
.css("left", s_position.left + this.div.width() - this.selectPopup.width());
};
/**
* Get the currently displayed columns
* Each customfield is listed separately
*/
et2_nextmatch.prototype.get_columns = function () {
var colMgr = this.dataview.getColumnMgr();
var visibility = colMgr.getColumnVisibilitySet();
var colDisplay = [];
var custom_fields = [];
// visibility is indexed by internal ID, widget is referenced by position, preference needs name
for (var i = 0; i < colMgr.columns.length; i++) {
// @ts-ignore
var widget = this.columns[i].widget;
var colName = this._getColumnName(widget);
if (colName) {
// Server side wants each cf listed as a seperate column
if (widget.instanceOf(et2_nextmatch_customfields)) {
// Just the ID for server side, not the whole nm name - some apps use it to skip custom fields
colName = widget.id;
for (var name_2 in widget.options.fields) {
if (widget.options.fields[name_2])
custom_fields.push(et2_nextmatch_customfields.PREFIX + name_2);
}
}
if (visibility[colMgr.columns[i].id].visible) {
colDisplay.push(colName);
}
}
}
// List each customfield as a seperate column
jQuery.merge(colDisplay, custom_fields);
return this.sortedColumnsList.length > 0 ? this.sortedColumnsList : colDisplay;
};
/**
* Set the currently displayed columns, without updating user's preference
*
@ -2017,8 +2050,7 @@ var et2_nextmatch = /** @class */ (function (_super) {
};
jQuery.extend(value, this.activeFilters, this.value);
if (typeof value.selectcols == "undefined" || value.selectcols.length === 0) {
this._updateUserPreferences();
value.selectcols = this.activeFilters.selectcols;
value.selectcols = this.get_columns();
}
return value;
};

View File

@ -2136,6 +2136,47 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
.css("left", s_position.left + this.div.width() - this.selectPopup.width());
}
/**
* Get the currently displayed columns
* Each customfield is listed separately
*/
get_columns()
{
const colMgr = this.dataview.getColumnMgr();
const visibility = colMgr.getColumnVisibilitySet();
const colDisplay = [];
const custom_fields = [];
// visibility is indexed by internal ID, widget is referenced by position, preference needs name
for(var i = 0; i < colMgr.columns.length; i++)
{
// @ts-ignore
const widget = this.columns[i].widget;
let colName = this._getColumnName(widget);
if(colName)
{
// Server side wants each cf listed as a seperate column
if(widget.instanceOf(et2_nextmatch_customfields))
{
// Just the ID for server side, not the whole nm name - some apps use it to skip custom fields
colName = widget.id;
for(let name in widget.options.fields) {
if(widget.options.fields[name]) custom_fields.push(et2_nextmatch_customfields.PREFIX+name);
}
}
if(visibility[colMgr.columns[i].id].visible)
{
colDisplay.push(colName);
}
}
}
// List each customfield as a seperate column
jQuery.merge(colDisplay, custom_fields);
return this.sortedColumnsList.length > 0 ? this.sortedColumnsList : colDisplay;
}
/**
* Set the currently displayed columns, without updating user's preference
*
@ -2717,8 +2758,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
if(typeof value.selectcols == "undefined" || value.selectcols.length === 0)
{
this._updateUserPreferences();
value.selectcols = this.activeFilters.selectcols;
value.selectcols = this.get_columns();
}
return value;
}

View File

@ -805,8 +805,8 @@ var EgwApp = /** @class */ (function () {
if (typeof favorite.state != 'undefined' && typeof state[state_key] != 'undefined' && typeof favorite.state[state_key] != 'undefined' && (state[state_key] == favorite.state[state_key] || !state[state_key] && !favorite.state[state_key])) {
match_count++;
}
else if (state_key == 'selectcols') {
// Skip, might be set, might not
else if (state_key == 'selectcols' && typeof favorite.state.selectcols == "undefined") {
// Skip, not set in favorite
}
else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object'
&& typeof favorite.state != 'undefined' && typeof favorite.state[state_key] != 'undefined' && favorite.state[state_key] && typeof favorite.state[state_key] === 'object') {

View File

@ -1032,9 +1032,9 @@ export abstract class EgwApp
{
match_count++;
}
else if (state_key == 'selectcols')
else if (state_key == 'selectcols' && typeof favorite.state.selectcols == "undefined")
{
// Skip, might be set, might not
// Skip, not set in favorite
}
else if (typeof state[state_key] != 'undefined' && state[state_key] && typeof state[state_key] === 'object'
&& typeof favorite.state != 'undefined' && typeof favorite.state[state_key] != 'undefined' && favorite.state[state_key] && typeof favorite.state[state_key] === 'object')