From 87a055e7bd3a62f4915082efe12bdf2f7ae7f3dd Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 9 Mar 2023 12:57:17 +0100 Subject: [PATCH] Fix tree's actions no longer available after refreshing the root node --- api/js/etemplate/et2_widget_tree.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_tree.ts b/api/js/etemplate/et2_widget_tree.ts index dbf9089a82..dbf0cc1945 100644 --- a/api/js/etemplate/et2_widget_tree.ts +++ b/api/js/etemplate/et2_widget_tree.ts @@ -657,7 +657,23 @@ export class et2_tree extends et2_inputWidget else { this.input.loadJSON(this.egw().link(this.autoloading_url, {id: _id}), - function(dxmlObject) {self._dhtmlxtree_json_callback(JSON.parse(dxmlObject.xmlDoc.responseText), _id);} + function(dxmlObject) { + self._dhtmlxtree_json_callback(JSON.parse(dxmlObject.xmlDoc.responseText), _id); + + // refreshing root node causes binding actions fails in dhtmlx tree, we try to refresh the opened node + // in order to rebind the actions again. + if (_id == 0) + { + let openedId = self._oldValue.split("::")[0]; + let interval = setInterval(()=> { + if (self.input.getOpenState(openedId)) + { + clearInterval(interval); + self.refreshItem(openedId); + } + }, 100); + } + } ); } }