Added Select All/Select None buttons to Excel importer

This commit is contained in:
Daniel Sader 2019-04-01 14:53:50 -03:00
parent ebaad96dfc
commit d21ca26b2f
2 changed files with 28 additions and 2 deletions

View File

@ -11,6 +11,8 @@
<tr> <tr>
<td><div class="grid-layout layout-tightest"><table bind="sheetRecordContainer"> <td><div class="grid-layout layout-tightest"><table bind="sheetRecordContainer">
<tr><td colspan="3" id="or-import-worksheet"></td></tr> <tr><td colspan="3" id="or-import-worksheet"></td></tr>
<tr><td colspan="1"><button class="button" bind="selectAllButton"></button></td>
<td colspan="1"><button class="button" bind="unselectAllButton"></button></td></tr>
</table></div></td> </table></div></td>
<td><div class="grid-layout layout-tightest"><table> <td><div class="grid-layout layout-tightest"><table>

View File

@ -118,9 +118,12 @@ Refine.ExcelParserUI.prototype._initialize = function() {
this._optionContainer.unbind().empty().html( this._optionContainer.unbind().empty().html(
DOM.loadHTML("core", "scripts/index/parser-interfaces/excel-parser-ui.html")); DOM.loadHTML("core", "scripts/index/parser-interfaces/excel-parser-ui.html"));
this._optionContainerElmts = DOM.bind(this._optionContainer); this._optionContainerElmts = DOM.bind(this._optionContainer);
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview')); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
this._optionContainerElmts.selectAllButton.click(function() { self._selectAll(); });
this._optionContainerElmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._optionContainerElmts.unselectAllButton.click(function() { self._unselectAll(); });
this._optionContainerElmts.unselectAllButton.html($.i18n('core-buttons/unselect-all'));
$('#or-import-worksheet').text($.i18n('core-index-import/import-worksheet')); $('#or-import-worksheet').text($.i18n('core-index-import/import-worksheet'));
$('#or-import-ignore').text($.i18n('core-index-parser/ignore-first')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n('core-index-parser/lines-beg')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
@ -142,6 +145,7 @@ Refine.ExcelParserUI.prototype._initialize = function() {
var checkbox = $('<input>') var checkbox = $('<input>')
.attr('id', id) .attr('id', id)
.attr('type', 'checkbox') .attr('type', 'checkbox')
.attr('class', 'core-excel-worksheet')
.attr('index', i) .attr('index', i)
.appendTo(td0); .appendTo(td0);
if (this.selected) { if (this.selected) {
@ -222,3 +226,23 @@ Refine.ExcelParserUI.prototype._updatePreview = function() {
self._progressContainer.hide(); self._progressContainer.hide();
}); });
}; };
Refine.ExcelParserUI.prototype._selectAll = function() {
var self = this;
$(".core-excel-worksheet").each(function(index, value){
$(value).prop('checked', true);
});
self._scheduleUpdatePreview();
}
Refine.ExcelParserUI.prototype._unselectAll = function() {
var self = this;
$(".core-excel-worksheet").each(function(index, value){
$(value).prop('checked', false);
});
self._scheduleUpdatePreview();
}