[英]Tabulator fitData layout not resizing width of table
我正在尝试将 Tabulator v4.6.3 与fitData布局一起使用。 这是我的代码:
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 } }
]
产生这个: 我的问题是右侧的黑色部分似乎表格没有正确调整大小。 每当我使用布局选项fitColumns时,它都能正常工作,并且是下图的全宽,但列太宽了。 我尝试在表格代码下方执行table.redraw() ,但这并不能解决任何问题。 如果有人对如何删除右侧的黑色部分有解决方案,将不胜感激。
谢谢。
那是正确渲染。
在fitData布局模式下,列会调整大小以适应它们的数据/列标题,这正是那里发生的情况,右侧的备用空间为空。
如果要填充空白空间,则应使用fitDataFill或fitDataStretch布局模式。
Taubulator 网站在布局示例部分中提供了每种布局模式的示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.