From cbcb2733674f8a97cfa02a22579ad5be617d4863 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 13 Apr 2015 17:20:47 +0000 Subject: [PATCH] Remove all actions before setting to prevent conflicts between old and new actions with the same id Also update existing row actions (fixes issue with r52449) --- etemplate/js/et2_extension_nextmatch.js | 4 ++++ etemplate/js/et2_extension_nextmatch_controller.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 44505abd70..628fb3796c 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -1688,6 +1688,10 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin set_actions: function(actions) { if(actions != this.options.actions && this.controller != null && this.controller._actionManager) { + for(var i = this.controller._actionManager.children.length - 1; i >= 0; i--) + { + this.controller._actionManager.children[i].remove(); + } this.options.actions = actions; this.options.settings.action_links = this.controller._actionLinks = this._get_action_links(actions); diff --git a/etemplate/js/et2_extension_nextmatch_controller.js b/etemplate/js/et2_extension_nextmatch_controller.js index b26f5c0f70..6c8364b8a7 100644 --- a/etemplate/js/et2_extension_nextmatch_controller.js +++ b/etemplate/js/et2_extension_nextmatch_controller.js @@ -285,6 +285,20 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(et2_IDataProvider, | EGW_AO_FLAG_DEFAULT_FOCUS | EGW_AO_FLAG_IS_CONTAINER; this._init_links_dnd(this._actionManager); + + if(this._selectionMgr) + { + // Need to update the action links for every registered row too + for (var uid in this._selectionMgr._registeredRows) + { + // Get the corresponding entry from the registered rows array + var entry = this._selectionMgr._getRegisteredRowsEntry(uid); + if(entry.ao) + { + entry.ao.updateActionLinks(this._actionLinks); + } + } + } }, /**