From e6bc7940b3639c36a62e19b81e3fc42b10b5e0e2 Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 16 Nov 2017 10:03:01 -0700 Subject: [PATCH] Etemplate - implement DetachedDOM interface on read-only checkbox, fixes set for every row bug in nextmatch --- api/js/etemplate/et2_widget_checkbox.js | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/et2_widget_checkbox.js b/api/js/etemplate/et2_widget_checkbox.js index 6041fb02b1..5a52ecd2d5 100644 --- a/api/js/etemplate/et2_widget_checkbox.js +++ b/api/js/etemplate/et2_widget_checkbox.js @@ -180,7 +180,7 @@ et2_register_widget(et2_checkbox, ["checkbox"]); * et2_checkbox_ro is the dummy readonly implementation of the checkbox * @augments et2_checkbox */ -var et2_checkbox_ro = (function(){ "use strict"; return et2_checkbox.extend( +var et2_checkbox_ro = (function(){ "use strict"; return et2_checkbox.extend([et2_IDetachedDOM], { /** * Ignore unset value @@ -220,6 +220,36 @@ var et2_checkbox_ro = (function(){ "use strict"; return et2_checkbox.extend( } else { this.span.text(this.options.ro_false); } + }, + + /** + * Code for implementing et2_IDetachedDOM + * + * @param {array} _attrs + */ + getDetachedAttributes: function(_attrs) + { + _attrs.push("value", "class"); + }, + + getDetachedNodes: function() + { + return [this.span[0]]; + }, + + setDetachedAttributes: function(_nodes, _values) + { + // Update the properties + if (typeof _values["value"] != "undefined") + { + this.span = jQuery(_nodes[0]); + this.set_value(_values["value"]); + } + + if (typeof _values["class"] != "undefined") + { + _nodes[0].setAttribute("class", _values["class"]); + } } });}).call(this); et2_register_widget(et2_checkbox_ro, ["checkbox_ro"]);