From e24b5578a3dd3cc2a65dfc11b1531186b6a615d1 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 3 Oct 2023 11:40:38 -0600 Subject: [PATCH] Api: Show nm columns from favourites, automatically reloading if needed to get missing columns --- api/js/etemplate/et2_extension_nextmatch.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 10a4d5bc54..32bde92a6c 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -2180,6 +2180,7 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 { const columnMgr = this.dataview.getColumnMgr(); const visibility = {}; + let need_reload = false; // Initialize to false for(var i = 0; i < columnMgr.columns.length; i++) @@ -2230,7 +2231,21 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 (widget).set_visible(visible); } this.columns[i].visible = visibility[columnMgr.columns[i].id].visible; + + if(this.dataview.rowProvider._columnIds.indexOf(columnMgr.columns[i].id) == -1) + { + need_reload = true; + } } + + if(need_reload) + { + // We need to change preferences and reload to get columns that were hidden during the first load + this.dataview.updateColumns(); + this.getInstanceManager().submit(); + return; + } + columnMgr.setColumnVisibilitySet(visibility); // We don't want to update user's preference, so directly update