From f9c4f6898e4e52137a6e5a87ff353839408c409b Mon Sep 17 00:00:00 2001 From: ng110 Date: Tue, 20 Jan 2015 12:34:24 +0000 Subject: [PATCH] Add capability for widgets to trigger all descendant action widgets, rather than just immediate children. Preserves compatibility with existing invokeActions call in button widget by creating a separate 'invokeActionCall' function to carry out the recursion. Triggering all descendants permits use of action widgets inside list widgets or macros. Also makes it possible to add triggering capability to select widget. --- core/modules/widgets/widget.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index c04f1bf96..b90558192 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -476,15 +476,25 @@ Widget.prototype.removeChildDomNodes = function() { }; /* -Invoke any action widgets that are immediate children of this widget +Invoke any action widgets that are descendants of this widget. */ Widget.prototype.invokeActions = function(event) { + return this.invokeActionCall(this, event); +}; + +/* +Recursively search through descendants, invoking all actions encountered. +*/ +Widget.prototype.invokeActionCall = function(here, event) { var handled = false; - for(var t=0; t