From e4b158be4bdc95b20753d335169a71db12c8f230 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 19 Aug 2013 20:23:26 +0000 Subject: [PATCH] Give nextmatch a real getValue() function instead of faking it all the time. --- etemplate/js/et2_extension_nextmatch.js | 16 +++++++++++++++- .../js/et2_extension_nextmatch_actions.js | 19 ++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 61c28c82e9..bd91562ec1 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -1194,7 +1194,21 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput], }, // Input widget - getValue: function() { return null;}, + getValue: function() { + var _ids = this.getSelection(); + + // Translate the internal uids back to server uids + var idsArr = _ids.ids; + for (var i = 0; i < idsArr.length; i++) + { + idsArr[i] = idsArr[i].split("::").pop(); + } + var value = { + "selected": idsArr, + } + jQuery.extend(value, this.activeFilters); + return value; + }, resetDirty: function() {}, isDirty: function() { return false;}, isValid: function() { return true;} diff --git a/etemplate/js/et2_extension_nextmatch_actions.js b/etemplate/js/et2_extension_nextmatch_actions.js index b83b8d51f1..9f5bce4a9e 100644 --- a/etemplate/js/et2_extension_nextmatch_actions.js +++ b/etemplate/js/et2_extension_nextmatch_actions.js @@ -160,14 +160,15 @@ function nm_action(_action, _senders, _target, _ids) if(nextmatch) { // Fake a getValue() function + var old_value = nextmatch.getValue; + var value = nextmatch.getValue(); + jQuery.extend(value, this.activeFilters, { + "selected": idsArr, + "checkboxes": checkboxes_elem ? checkboxes_elem.value : null + }); + value[nextmatch.options.settings.action_var]= _action.id; + nextmatch.getValue = function() { - var value = { - "selected": idsArr, - "checkboxes": checkboxes_elem ? checkboxes_elem.value : null - }; - jQuery.extend(value, this.activeFilters); - value[nextmatch.options.settings.action_var]= _action.id; - //if(_target && _target.id) value[_target.id] = true; return value; } @@ -178,8 +179,8 @@ function nm_action(_action, _senders, _target, _ids) nextmatch.getInstanceManager().submit(); - // Clear action in case there's another one - delete nextmatch.getValue; + // Reset action in case there's another one + nextmatch.getValue = old_value; } else {