[SSE] Set encoding for data from file

This commit is contained in:
Julia Radzhabova 2021-03-22 16:45:42 +03:00
parent abafb4eb82
commit 89d44c31fe
2 changed files with 6 additions and 5 deletions

View file

@ -57,7 +57,7 @@ define([
if (options.preview) { if (options.preview) {
width = 414; width = 414;
height = (options.type==Common.Utils.importTextType.Data) ? 330 : 277; height = (options.type==Common.Utils.importTextType.Data) ? 385 : 277;
} else { } else {
width = (options.type !== Common.Utils.importTextType.DRM) ? 340 : (options.warning ? 420 : 280); width = (options.type !== Common.Utils.importTextType.DRM) ? 340 : (options.warning ? 420 : 280);
switch (options.type) { switch (options.type) {
@ -111,7 +111,7 @@ define([
'<% } %>', '<% } %>',
'<% } else { %>', '<% } else { %>',
'<% if (codepages && codepages.length>0) { %>', '<% if (codepages && codepages.length>0) { %>',
'<div style="<% if (!!preview && (type == Common.Utils.importTextType.CSV || type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns || type == Common.Utils.importTextType.Data)) { %>width: 230px;margin-right: 10px;display: inline-block;<% } else { %>width: 100%;<% } %>margin-bottom:15px;">', '<div style="<% if (!!preview && (type == Common.Utils.importTextType.CSV || type == Common.Utils.importTextType.Paste || type == Common.Utils.importTextType.Columns)) { %>width: 230px;margin-right: 10px;display: inline-block;<% } else { %>width: 100%;<% } %>margin-bottom:15px;">',
'<label class="header">' + t.txtEncoding + '</label>', '<label class="header">' + t.txtEncoding + '</label>',
'<div>', '<div>',
'<div id="id-codepages-combo" class="input-group-nr" style="width: 100%; display: inline-block; vertical-align: middle;"></div>', '<div id="id-codepages-combo" class="input-group-nr" style="width: 100%; display: inline-block; vertical-align: middle;"></div>',
@ -133,7 +133,7 @@ define([
'<div>', '<div>',
'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>', '<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 100px;display: inline-block; vertical-align: middle;"></div>',
'<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>', '<div id="id-delimiter-other" class="input-row" style="display: inline-block; vertical-align: middle;margin-left: 10px;"></div>',
'<button type="button" class="btn btn-text-default" id="id-delimiters-advanced" style="min-width:100px; display: inline-block;float:right;">' + t.txtAdvanced + '</button>', '<button type="button" class="btn auto btn-text-default" id="id-delimiters-advanced" style="min-width:100px; display: inline-block;float:right;">' + t.txtAdvanced + '</button>',
'</div>', '</div>',
'</div>', '</div>',
'<% } %>', '<% } %>',

View file

@ -253,7 +253,7 @@ define([
} }
}, },
onDataFromTextCallback: function(data) { onDataFromTextCallback: function(data, advOptions) {
if (!data || !data.length) return; if (!data || !data.length) return;
var me = this; var me = this;
@ -263,7 +263,8 @@ define([
type: Common.Utils.importTextType.Data, type: Common.Utils.importTextType.Data,
preview: true, preview: true,
previewData: data, previewData: data,
settings: me._state.CSVOptions, settings: advOptions ? advOptions.asc_getRecommendedSettings() : me._state.CSVOptions,
codepages: advOptions ? advOptions.asc_getCodePages() : null,
api: me.api, api: me.api,
handler: function (result, encoding, delimiter, delimiterChar, decimal, thousands, range) { handler: function (result, encoding, delimiter, delimiterChar, decimal, thousands, range) {
if (result == 'ok') { if (result == 'ok') {