From 07e1d35f94052ea16a2498add6e1fdd9475fc79c Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 13 Oct 2023 09:59:29 +0800 Subject: [PATCH] * common: optimize dtable layout without auto size col. --- module/common/view/zui3dtable.html.php | 22 ++++++++++------------ module/execution/view/all.html.php | 1 - 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/module/common/view/zui3dtable.html.php b/module/common/view/zui3dtable.html.php index 290cdac92f..bed0730d83 100644 --- a/module/common/view/zui3dtable.html.php +++ b/module/common/view/zui3dtable.html.php @@ -22,30 +22,28 @@ window.setCheckedCookie = function() $.cookie('checkedItem', dtable.$.getChecks().join(','), {expires: config.cookieLife, path: config.webRoot}); }; -function convertCols(cols) -{ - cols.forEach(function(col) - { - if(col.fixed == 'no') col.fixed = false; - if(col.type === 'html' && col.flex === undefined) col.flex = col.width === 'auto' ? 1 : false; - }); - - return cols; -} zui.DTable.definePlugin( { name: 'zentao18', options: function(options) { + let allLeftColsFixed = true; + const cols = options.cols.map(function(col) + { + if(col.fixed == 'no') col.fixed = false; + if(col.type === 'html' && col.flex === undefined) col.flex = col.width === 'auto' ? 1 : false; + if(col.width === 'auto') allLeftColsFixed = false; + return col; + }); return $.extend({fixedLeftWidth: '40%'}, options, { - cols: convertCols(options.cols), + cols: cols, height: function(actualHeight) { const height = Math.max(0, window.innerHeight - ($('#mainContent').offset().top || 0)) - 1; $('#sidebar>.cell').css('maxHeight', height).children('.tree').addClass('scrollbar-hover'); return Math.min(actualHeight, height - ($('#mainContent .table-footer').outerHeight() || 0)); } - }); + }, allLeftColsFixed ? {fixedLeftWidth: 'auto'} : {}); }, onMounted: function() { diff --git a/module/execution/view/all.html.php b/module/execution/view/all.html.php index e08710a54d..b54743ce66 100644 --- a/module/execution/view/all.html.php +++ b/module/execution/view/all.html.php @@ -115,7 +115,6 @@ js::set('isCNLang', !$this->loadModel('common')->checkNotCN());