From 104680c4770335889efa41ba3e69d7cf55d01421 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 7 Nov 2022 14:51:42 -0700 Subject: [PATCH] Fix hidden nm with no initial rows were requesting data too early --- admin/inc/class.admin_ui.inc.php | 13 +++++++------ admin/js/app.ts | 1 + api/js/etemplate/et2_extension_nextmatch.ts | 12 ++++++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index 11e7271fdd..3af494e1b0 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -65,12 +65,13 @@ class admin_ui 'placeholder_actions' => array('add') ); $content['groups'] = array( - 'get_rows' => 'admin_ui::get_groups', - 'no_cat' => true, - 'no_filter' => true, - 'no_filter2' => true, - 'row_id' => 'account_id', - 'actions' => self::group_actions(), + 'get_rows' => 'admin_ui::get_groups', + 'no_cat' => true, + 'no_filter' => true, + 'no_filter2' => true, + 'num_rows' => 0, + 'row_id' => 'account_id', + 'actions' => self::group_actions(), 'placeholder_actions' => array('add') ); diff --git a/admin/js/app.ts b/admin/js/app.ts index 884d822189..99179ad161 100644 --- a/admin/js/app.ts +++ b/admin/js/app.ts @@ -500,6 +500,7 @@ class AdminApp extends EgwApp { this.nm.set_disabled(true); this.groups.set_disabled(false); + jQuery(this.et2.parentNode).trigger('show.et2_nextmatch'); } diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 79da7db8ae..3a92c4df80 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -2428,10 +2428,18 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2 // TODO this.controller.setFilters(this.activeFilters); // If no data was sent from the server, and num_rows is 0, the nm will be empty. - // This triggers a cache check. + // This triggers a cache check if visible if(!this.options.settings.num_rows && this.controller) { - this.controller.update(); + if(jQuery(this.getDOMNode()).filter(":visible").length > 0) + { + this.controller.update(); + } + else + { + // Not visible, queue it up + this._queue_refresh([], et2_nextmatch.EDIT); + } } // Load the default sort order