CustomTabularExporterDialog: fix checkbox options being ignored (#2429)

Any value (even an empty string) of the checked attribute will be threated as checked. Fixed by passing null to jQuerys attr function which removes the attribute.
https://stackoverflow.com/questions/4228658/what-values-for-checked-and-selected-are-false
This commit is contained in:
Albin Larsson 2020-03-18 05:54:04 +01:00 committed by GitHub
parent 0233e7186b
commit 1bbf3df0f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -255,12 +255,10 @@ CustomTabularExporterDialog.prototype._configureUIFromOptionCode = function(opti
this._elmts.separatorInput[0].value = escapeJavascriptString(options.separator || ','); this._elmts.separatorInput[0].value = escapeJavascriptString(options.separator || ',');
this._elmts.lineSeparatorInput[0].value = escapeJavascriptString(options.lineSeparator || '\n'); this._elmts.lineSeparatorInput[0].value = escapeJavascriptString(options.lineSeparator || '\n');
this._elmts.encodingInput[0].value = options.encoding; this._elmts.encodingInput[0].value = options.encoding;
this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : ''); this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : null);
this._elmts.outputEmptyRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : ''); this._elmts.outputEmptyRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : null);
if (options.quoteAll) { this._elmts.quoteAllCheckbox.attr('checked', (options.quoteAll) ? 'checked' : null);
this._elmts.quoteAllCheckbox.attr('checked');
}
if (options.columns !== null) { if (options.columns !== null) {
var self = this; var self = this;
this._elmts.columnList.find('.custom-tabular-exporter-dialog-column input[type="checkbox"]').attr('checked', false); this._elmts.columnList.find('.custom-tabular-exporter-dialog-column input[type="checkbox"]').attr('checked', false);