From 0fbe4b7ae720c61941937777a1e92ea8902aa58a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 17 Feb 2015 22:04:24 +0000 Subject: [PATCH] Fix some nextmatch custom field bugs: - no custom fields in nm rows when there were none explicitly selected - Custom field column shown even if none were defined --- etemplate/js/et2_extension_nextmatch.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index c88647c462..e57483fd64 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -1247,6 +1247,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin // Custom fields get listed separately if(widget.instanceOf(et2_nextmatch_customfields)) { + if(jQuery.isEmptyObject(widget.customfields)) + { + // No customfields defined, don't show column + delete(columns[col.id]); + continue; + } for(var field_name in widget.customfields) { columns[widget.prefix+field_name] = " - "+widget.customfields[field_name].label; @@ -2753,6 +2759,7 @@ var et2_nextmatch_customfields = et2_customfields_list.extend(et2_INextmatchHead } var columnMgr = this.nextmatch.dataview.getColumnMgr(); var nm_column = null; + var set_fields = {}; for(var i = 0; i < this.nextmatch.columns.length; i++) { if(this.nextmatch.columns[i].widget == this) @@ -2816,7 +2823,13 @@ var et2_nextmatch_customfields = et2_customfields_list.extend(et2_INextmatchHead { cf.hide(); } + else if (jQuery.isEmptyObject(this.options.fields)) + { + // If we're showing it make sure it's set, but only after + set_fields[field_name] = true; + } } + jQuery.extend(this.options.fields, set_fields); }, /**