简体   繁体   English

制表符 fitData 布局未调整表格宽度

[英]Tabulator fitData layout not resizing width of table

I'm trying to use Tabulator v4.6.3 with the fitData layout.我正在尝试将 Tabulator v4.6.3 与fitData布局一起使用。 Here's my code:这是我的代码:

var table = new Tabulator("#cowTable", {
        data: cowTableData,
        layout: "fitData",
        history: true,
        columns: [
            { title: "Cow ID", field: "cowId", editor: "number", editorParams: { step: 1 } },
            { title: "Enter", field: "enter", editor: "number", editorParams: { step: 100 } },
            { title: "Exit", field: "exit", editor: "number", editorParams: { step: 100 } },
            { title: "Strip Status", field: "strip", editor: "select", editorParams: { "active": "Active", "inactive": "Inactive", "absent": "Absent" } },
            { title: "Mobility", field: "mobility", editor: "number", editorParams: { min: 0, max: 3, step: 0.05 } },
            { title: "Body Condition", field: "bodycond", editor: "number", editorParams: { min: 0, max: 4, step: 0.05 } }
        ]

Which produces this:产生这个: 表输出 My issue is the black part to the right that seems like the table isn't resizing properly.我的问题是右侧的黑色部分似乎表格没有正确调整大小。 Whenever I use the layout option fitColumns , it works fine and is the full width of the image below but the columns are too wide.每当我使用布局选项fitColumns时,它都能正常工作,并且是下图的全宽,但列太宽了。 I've tried to do table.redraw() below the code of the table, but this doesn't fix anything.我尝试在表格代码下方执行table.redraw() ,但这并不能解决任何问题。 If anyone has a solution on how to remove the black part to the right, that would be greatly appreciated.如果有人对如何删除右侧的黑色部分有解决方案,将不胜感激。

Thanks.谢谢。

That is rendering correctly.那是正确渲染。

In fitData layout mode the columns resize to fit their data/column titles which is exactly what is happening there, and spare space on the right is then empty.fitData布局模式下,列会调整大小以适应它们的数据/列标题,这正是那里发生的情况,右侧的备用空间为空。

If you want to fill the empty space then you should be using the fitDataFill or fitDataStretch layout modes.如果要填充空白空间,则应使用fitDataFillfitDataStretch布局模式。

The Taubulator website has examples of each layout mode in operation in the Layout Examples Section Taubulator 网站在布局示例部分中提供了每种布局模式的示例

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

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