admin管理员组文章数量:1134247
I have created a table with Tabulator that has several hundreds of rows grouped by a certain column. I changed the height property from 100% to pixels to enable virtual DOM that affected the performance by making the grid very responsive. The thing is that when I add a row to a group, the contents scroll uncontrollably.
the only solution that I came up with that somehow "works" is this that just brings the newly added row to the center of the table.
Tabulator version 6.3.0 on the latest Chrome
Any ideas?
{ // Calculate and set precise scroll position const tableHolder = table.element.querySelector(".tabulator-tableholder"); // Get the scroll container const addedRowElement = addedRow.getElement(); // Get the DOM element of the added row
if (tableHolder && addedRowElement) {
const rowPosition = addedRowElement.offsetTop; // Distance of the row from the top of the table
const holderHeight = tableHolder.offsetHeight; // Visible height of the table holder
// Center the row in the viewport
tableHolder.scrollTop = rowPosition - holderHeight / 2 + addedRowElement.offsetHeight / 2;
console.log("Scroll position adjusted for new row:", tableHolder.scrollTop);
} else {
console.error("Failed to adjust scroll position. Table holder or row element not found.");
}
}
本文标签: javascriptTAbulator addRow() causes uncontrolled scrolling with grouped rowsStack Overflow
版权声明:本文标题:javascript - TAbulator addRow() causes uncontrolled scrolling with grouped rows - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736786664a1952899.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论