* common: fix dtable responsive not work as expected.

This commit is contained in:
sunhao
2023-10-10 14:45:12 +08:00
parent 06dae869e2
commit 13dd1e0e8b
+8 -1
View File
@@ -3,6 +3,7 @@ js::import($jsRoot . 'dtable/min.js');
css::import($jsRoot . 'dtable/min.css');
?>
<style>
.page-has-dtable {overflow: hidden;}
#main {padding-bottom: 0;}
#sidebar > .cell {padding: 0; display: flex; flex-direction: column;}
#sidebar > .cell > .tree {flex: auto; overflow: auto; padding: 10px 10px 0;}
@@ -38,14 +39,20 @@ zui.DTable.definePlugin(
{
return $.extend({fixedLeftWidth: '40%'}, options, {
cols: convertCols(options.cols),
responsive: 'window',
height: function(actualHeight)
{
const height = Math.min(actualHeight, Math.max(0, window.innerHeight - ($('#mainContent').offset().top || 0)));
const height = Math.min(actualHeight, Math.max(0, window.innerHeight - ($('#mainContent').offset().top || 0))) - 1;
$('#sidebar>.cell').css('maxHeight', height).children('.tree').addClass('scrollbar-hover');
return height - ($('#mainContent .table-footer').outerHeight() || 0);
}
});
},
onMounted: function()
{
if(!$(this.parent).closest('#main').length) return;
$('body').addClass('page-has-dtable');
}
}, {buildIn: true})
zui.DTable.defineFn();