diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js
index f51d41bf8..95e6b3a86 100644
--- a/apps/common/main/lib/view/OpenDialog.js
+++ b/apps/common/main/lib/view/OpenDialog.js
@@ -91,11 +91,19 @@ define([
'<% if (!!preview) { %>',
'
',
'',
- '<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>',
- '
',
- '<% } else { %>',
- '
',
- '<% } %>',
+ '
',
+ '<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>',
+ '
',
+ '<% } else { %>',
+ '
',
+ '<% } %>',
+ '
',
'
',
'<% } %>',
'<% } %>',
@@ -132,7 +140,12 @@ define([
this.$window.find('.tool').hide();
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
- this.previewPanel = this.$window.find((this.type == Asc.c_oAscAdvancedOptionsID.CSV) ? '#id-preview-csv' : '#id-preview-txt');
+ this.previewPanel = this.$window.find((this.type == Asc.c_oAscAdvancedOptionsID.CSV) ? '#id-preview-csv-data' : '#id-preview-txt');
+ if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
+ this.csvPreview = this.$window.find('#id-preview-csv');
+ this.csvPreviewInner = this.csvPreview.find('div:first-child');
+ this.previewParent = this.previewPanel.parent();
+ }
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
this.inputPwd = new Common.UI.InputField({
@@ -413,90 +426,93 @@ define([
},
updatePreview: function() {
- if (!_.isUndefined(this.previewScroller)) {
- this.previewScroller.destroy();
- delete this.previewScroller;
- }
-
if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null,
delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null;
(delimiter == -1) && (delimiter = null);
- this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(this.cmbEncoding.getValue(), delimiter, delimiterChar), _.bind(this.previewCallback, this));
+ this.api.asc_decodeBuffer(this.preview, new Asc.asc_CCSVAdvancedOptions(this.cmbEncoding.getValue(), delimiter, delimiterChar), _.bind(this.previewCsvCallback, this));
} else {
- this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(this.cmbEncoding.getValue()), _.bind(this.previewCallback, this));
+ if (!_.isUndefined(this.previewYScroller)) {
+ this.previewYScroller.destroy();
+ delete this.previewYScroller;
+ }
+ this.api.asc_decodeBuffer(this.preview, new Asc.asc_CTXTAdvancedOptions(this.cmbEncoding.getValue()), _.bind(this.previewTxtCallback, this));
}
},
- previewCallback: function(data) {
+ previewTxtCallback: function(data) {
if (!data || !data.length) return;
- if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) {
- var maxlength = 0;
- for (var i=0; i