VisActor / VisActor/VTable

[Bug] 添加分页后,导出只能导出当前的表格页内容

Open
#3,726 3 comments 0 reactions 1 assignee View on GitHub

@Rui-Sun is already working on this.

Since Apr 11, 2025.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
486
Avg merge
1d 19h
Merged PRs (30d)
16

Description

Version

1.0

Link to Minimal Reproduction

[Bug] 添加分页后,导出只能导出当前的表格页内容

Steps to Reproduce

[Bug] 添加分页后,导出只能导出当前的表格页内容
分页代码
function createPagination(totalPages, currentPage) {
if (document.getElementById('pagination-container')) {
document.getElementById('pagination-container')
.parentElement.removeChild(document.getElementById('pagination-container'));
}
// 创建一个style元素来添加CSS样式
const paginationContainer = document.createElement('div');
paginationContainer.id = 'pagination-container';
paginationContainer.style.position = "absolute";
paginationContainer.style.top = "calc(83% - 5px)";
paginationContainer.style.left = "10px";
container.parentElement.appendChild(paginationContainer);

    paginationContainer.innerHTML = '';
    // 创建一个无序列表作为分页的容器
    const ul = document.createElement('ul');
    ul.className = 'pagination';

    // 为每一页创建一个列表项
    for (let i = 1; i <= totalPages; i++) {
        // 创建列表项
        const li = document.createElement('li');
        // 创建链接
        const a = document.createElement('a');
        a.innerText = i;
        a.href = '?page=' + i;
        if(i===1){
            a.id=  'first-page-link';
        }
        a.className = i === currentPage ? 'active' : '';
        a.onclick = function (event) {
            event.preventDefault();
            let tempOption = {
                records: [],
                columns,
                widthMode: 'standard',
                autoFillWidth: true,
            }
            tableInstance = new VTable.ListTable(document.getElementById("tableContainer"), tempOption);
            setTimeout(() => {
                tableInstance = new VTable.ListTable(document.getElementById("tableContainer"), option);
                // 重新创建分页组件
                createPagination(totalPages, i);
                selectedPage = i;
                tableInstance.updatePagination({
                    currentPage: i - 1
                });
            }, 100)
        };
        li.appendChild(a);
        ul.appendChild(li); // 将列表项添加到无序列表中
    }
    paginationContainer.appendChild(ul); // 将分页组件添加到容器中

}

导出方法
async function exportExcel() {
if (tableInstance) {
console.log("导出tableInstance")

        downloadExcel(await exportVTableToExcel(tableInstance,option), 'TRB及时率');
    }
}
Current Behavior

希望分页后,能够导出全部数据

Expected Behavior

[Bug] 添加分页后,导出只能导出当前的表格页内容

Environment
- OS:
- Browser:
- Framework:
Any additional comments?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.