From f3ba7f692fdae458d655cbc4bebe13bd2a9a89cc Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 11 Jun 2014 18:03:19 +0000 Subject: [PATCH] Use custom field name to toggle row visibility, not order, as order doesn't always work. --- etemplate/js/et2_extension_customfields.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_extension_customfields.js b/etemplate/js/et2_extension_customfields.js index 7a37d09485..43691026f7 100644 --- a/etemplate/js/et2_extension_customfields.js +++ b/etemplate/js/et2_extension_customfields.js @@ -219,6 +219,7 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput // Add field label & help as data attribute to row, so it can be stylied with CSS (title should be disabled) row.attr('title', field.label); row.attr('data-label', field.label); + row.attr('data-field', field_name); row.attr('data-help', field.help); this.detachedNodes.push(row[0]); } else { @@ -539,12 +540,11 @@ var et2_customfields_list = et2_valueWidget.extend([et2_IDetachedDOM, et2_IInput // Individual widgets are detected and handled by the grid, but the interface is needed for this to happen // Show the row if there's a value, hide it if there is no value - var cf_index = 0 - for(var key in _values.fields) + for(var i = 0; i < _nodes.length; i++) { // toggle() needs a boolean to do what we want - $j(_nodes[cf_index]).toggle(_values.fields[key] && _values.value[this.prefix + key]?true:false); - cf_index++; + var key = _nodes[i].dataset.field; + $j(_nodes[i]).toggle(_values.fields[key] && _values.value[this.prefix + key]?true:false); } } });