在 Tabulator 中刷新组 header 的最佳方法是什么

What's the best way to refresh a group header in Tabulator

如果我有一个包含自定义计算的 custom Tabulator groupHeader 函数,例如:

noteCount = getNoteCount();
noteButton.innerText = `Notes (${noteCount})`;

当音符计数发生变化时,刷新 header 的最佳方法是什么?在这种情况下,我的 noteCount 变量独立于 table 数据。

我目前在更新笔记数量后使用setGroupBy函数:

tableName.setGroupBy("groupField");

这有效,但似乎 heavy-handed 因为它重置了整个 table 的分组。它还将滚动位置重置为 table 的顶部。我宁愿只针对一个群体 header,这可能吗?

无法仅重绘组 header,因为它们仅在向组中添加或删除行时生成。

您可以尝试在 table:

上调用 redraw 函数
table.redraw();