简体   繁体   English

制表器:调整表格列宽时修复最右侧列的 position

[英]Tabulator: Fix position of right most column when adjusting table column width

How do i fix the position of the right most column?如何修复最右侧列的 position?

When trying to increase or decrease the size of a column, the right most column moves along with the adjustment, creating a gap or a horizontal scroll bar in the process.当尝试增加或减少列的大小时,最右边的列会随着调整而移动,在此过程中会产生间隙或水平滚动条。 Is there a way to adjust all the columns dynamically to allow the position of the right most column to stay fixed?有没有办法动态调整所有列以允许最右侧列的 position 保持固定?

Here are a few examples from the docs以下是文档中的一些示例

Gap from decreasing 3rd column width:减少第三列宽度的差距: 减少列宽的差距

Scroll bar from increasing 3rd column width:从增加第三列宽度的滚动条: 滚动条增加列宽

Layout Mode布局模式

If you want columns to resize then you should look at using the fitColumns layout mode.如果您想调整列的大小,那么您应该考虑使用fitColumns布局模式。 in the table constructor you should set this on the layout option:在表构造函数中,您应该在layout选项上设置它:

var table = new Tabulator("#example-table", {
    layout:"fitColumns",
});

This can be seen on the Fit To Width Example这可以在适合宽度示例中看到

Tabulator provides many options for configuring this layout mode to choose how to resize each column. Tabulator 提供了许多用于配置此布局模式的选项,以选择如何调整每列的大小。 More info on this can be found in the Layout Documentation可以在布局文档中找到更多信息

Frozen Columns冻结列

If you would alternatively like the column to remain where it is, even when the table is scrolled horizontally then you can use the frozen property on the column definition for the dob column to freeze it in place:如果您希望该列保持原位,即使表格水平滚动,您也可以使用dob列的列定义上的frozen属性将其冻结到位:

{title:"Date of Birth", field:"dob", frozen:true}}

More details on this can be found in the Frozen Columns DOcumentation更多细节可以在Frozen Columns DOcumentation中找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM