diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 1a1681619..f538650ec 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -183,6 +183,8 @@ define([ _options.tpl = _.template(this.template)(_options); + this._previewTdWidth = []; + this._previewTdMaxLength = 0; Common.UI.Window.prototype.initialize.call(this, _options); }, render: function () { @@ -417,6 +419,9 @@ define([ }, updatePreview: function() { + this._previewTdWidth = []; + this._previewTdMaxLength = 0; + var encoding = (this.cmbEncoding && !this.cmbEncoding.isDisabled()) ? this.cmbEncoding.getValue() : ((this.settings && this.settings.asc_getCodePage()) ? this.settings.asc_getCodePage() : 0); var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, @@ -488,15 +493,24 @@ define([ if (str.length>maxlength) maxlength = str.length; } + this._previewTdMaxLength = Math.max(this._previewTdMaxLength, maxlength); var tpl = ''; for (var i=0; i'; + var style = ''; + if (i==0 && this._previewTdWidth[j]) { // set td style only for first tr + style = 'style="min-width:' + this._previewTdWidth[j] + 'px;"'; + } + tpl += ''; } - for (j=str.length; j'; } tpl += ''; } @@ -511,6 +525,14 @@ define([ } this.previewPanel.html(tpl); + if (data.length>0) { + var me = this; + (this._previewTdWidth.length===0) && this.previewScrolled.scrollLeft(0); + this.previewPanel.find('tr:first td').each(function(index, el){ + me._previewTdWidth[index] = Math.max(Math.max(Math.ceil($(el).outerWidth()), 30), me._previewTdWidth[index] || 0); + }); + } + this.scrollerX = new Common.UI.Scroller({ el: this.previewPanel, suppressScrollY: true,
' + Common.Utils.String.htmlEncode(str[j]) + '