Skip to content

Incrorrect position of scroll bar after adding row #4730

@LTXHNN

Description

@LTXHNN

Describe the bug
When addRowPos is bottom, the position of the scrollbar is incorrect after adding a large amount of data. For example, I first added 100 rows of initial data, then dragged the scrollbar to the bottom, and manually added 300 rows of data. Finally, the position of the scrollbar was even closer to the bottom. Is it related to the calculation of bottom padding in the following code? When my addRowPos is top, if I add a large amount of data and then drag the scrollbar, the table will appear blank.

Tabulator Info

  • Which version of Tabulator are you using?
    "version": "6.3.0"
    Working Example
    `
<title>Document</title>
<!-- 引入 Tabulator CSS -->
<link href="./tabulator.min.css" rel="stylesheet">

<!-- 引入 Tabulator JS -->
<script src="./tabulator.js"></script>
Add Blank Row to bottom Remove Row "Oli Bob" Empty the table Reset
<div id="example-table"></div>

<script>
    let tabledata = [];
    for (let i = 0; i < 100; i++) {
        tabledata.push({ id: 1 + i, name: "Oli Bob"+i, location: "United Kingdom", gender: "male", rating: 1, col: "red", dob: "14/04/1984" });
    }

    //Build Tabulator
    let table = new Tabulator("#example-table", {
        height: "311px",
        data: tabledata, // 数据源
        addRowPos: "bottom",
        columns: [
            { title: "Name", field: "name", width: 200, editor: "input" },
            { title: "Progress", field: "progress", width: 100, hozAlign: "right", sorter: "number", editor: "input" },
            { title: "Gender", field: "gender", editor: "input" },
            { title: "Rating", field: "rating", hozAlign: "center", width: 80, editor: "input" },
            { title: "Favourite Color", field: "col", editor: "input" },
            { title: "Date Of Birth", field: "dob", hozAlign: "center", sorter: "date", editor: "input" },
            { title: "Driver", field: "car", hozAlign: "center", editor: "input" },
        ],
    });

    //Add row on "Add Row" button click
    document.getElementById("add-row").addEventListener("click", function () {
        let tabledata = [];
        for (let i = 700; i < 1000; i++) {
            tabledata.push({ id: 1 + i, name: "Oli Bob", location: "United Kingdom", gender: "male", rating: 1, col: "red", dob: "14/04/1984" });
        }
        table.addRow(tabledata);
    });
</script>
`

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions