Api: Fix favorites incorrectly saved with customfield column caused reload

Just "customfields" in the saved column list triggered an app reload because of the detected column mismatch.  Now ignoring customfield column if there are no customfields to show with it
This commit is contained in:
nathan 2024-03-13 10:48:10 -06:00
parent 7ed9eef29d
commit 84a452492d

View File

@ -2148,7 +2148,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
if(colName) if(colName)
{ {
// Server side wants each cf listed as a seperate column // Server side wants each cf listed as a seperate column
if(widget.instanceOf(et2_nextmatch_customfields)) if(widget.instanceOf(et2_nextmatch_customfields) && visibility[colMgr.columns[i].id].visible && visibility[colMgr.columns[i].id].enabled)
{ {
// Just the ID for server side, not the whole nm name - some apps use it to skip custom fields // Just the ID for server side, not the whole nm name - some apps use it to skip custom fields
colName = widget.id; colName = widget.id;
@ -2157,7 +2157,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
if(widget.options.fields[name]) custom_fields.push(et2_nextmatch_customfields.PREFIX + name); if(widget.options.fields[name]) custom_fields.push(et2_nextmatch_customfields.PREFIX + name);
} }
} }
if(visibility[colMgr.columns[i].id].visible) if(visibility[colMgr.columns[i].id].visible && visibility[colMgr.columns[i].id].enabled)
{ {
colDisplay.push(colName); colDisplay.push(colName);
} }
@ -2209,9 +2209,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
// Just the ID for server side, not the whole nm name - some apps use it to skip custom fields // Just the ID for server side, not the whole nm name - some apps use it to skip custom fields
colName = widget.id; colName = widget.id;
let show_custom_fields = false;
if(column_list.indexOf(colName) !== -1) if(column_list.indexOf(colName) !== -1)
{ {
visibility[columnMgr.columns[i].id].visible = true; show_custom_fields = true;
} }
const cf = this.columns[i].widget.options.customfields; const cf = this.columns[i].widget.options.customfields;
@ -2229,6 +2230,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
visible[column_list[j].substring(1)] = true; visible[column_list[j].substring(1)] = true;
} }
(<et2_nextmatch_customfields><unknown>widget).set_visible(visible); (<et2_nextmatch_customfields><unknown>widget).set_visible(visible);
visibility[columnMgr.columns[i].id].visible = show_custom_fields && Object.values(visible).filter(f => f).length > 0;
} }
this.columns[i].visible = visibility[columnMgr.columns[i].id]?.visible; this.columns[i].visible = visibility[columnMgr.columns[i].id]?.visible;