diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 934cfce30..f51d41bf8 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -131,6 +131,9 @@ define([ if (!this.closable) 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'); + if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) { this.inputPwd = new Common.UI.InputField({ el: $('#id-password-txt'), @@ -410,6 +413,11 @@ 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; @@ -441,10 +449,54 @@ define([ tpl += ''; } tpl += ''; - this.$window.find('#id-preview-csv').html(_.template(tpl)); + this.previewPanel.html(tpl); } else { - this.$window.find('#id-preview-txt').text(data); + this.previewPanel.text(data); } + this.previewScroller = new Common.UI.Scroller({ + el: this.previewPanel, + minScrollbarLength : 10 + }); + }, + + startLoadData: function() { + if (this.type == Asc.c_oAscAdvancedOptionsID.CSV) { + this.previewPanel.html('