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
This commit is contained in:
Nathan Gray 2015-02-17 18:02:10 +00:00
parent c988b33907
commit ae0c757ea2

View File

@ -1247,6 +1247,12 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Custom fields get listed separately // Custom fields get listed separately
if(widget.instanceOf(et2_nextmatch_customfields)) 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) for(var field_name in widget.customfields)
{ {
columns[widget.prefix+field_name] = " - "+widget.customfields[field_name].label; 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 columnMgr = this.nextmatch.dataview.getColumnMgr();
var nm_column = null; var nm_column = null;
var set_fields = {};
for(var i = 0; i < this.nextmatch.columns.length; i++) for(var i = 0; i < this.nextmatch.columns.length; i++)
{ {
if(this.nextmatch.columns[i].widget == this) if(this.nextmatch.columns[i].widget == this)
@ -2816,7 +2823,13 @@ var et2_nextmatch_customfields = et2_customfields_list.extend(et2_INextmatchHead
{ {
cf.hide(); 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);
}, },
/** /**