首页 > 解决方案 > gridjs - 如何在来自服务器的数据显示在表中后运行函数?

问题描述

这是我今天的代码:

new gridjs.Grid({
    columns: [
        { 
            name: 'Ticker',
            formatter: (cell) => gridjs.html(`<a class="offcanvasStockInfo" data-stock="${cell}" data-bs-toggle="offcanvas" data-bs-target="#offcanvasStockInfo" aria-controls="offcanvasStockInfo">${cell}</a>`)
        },
        "Name",
        "Date"
    ],
    resizable: true,
    //fixedHeader: true,
    //height: '400px',
    sort: false,
    search: true,
    server: {
        url: '/ajax/ajax_earningsCalendar.php',
        then: data => data.map(card => [card.stockTXT, card.nameTXT, card.nextEarningReport])
    },
    className: {
        td: 'gridjs-td-class',
        th: 'gridjs-th-class',
        table: 'gridjs-table-class'
    }
}).render(this);

setTimeout(function() {
    ShowMoreInfoStockData();
},1000);

我希望这部分可以在没有超时的情况下运行:

setTimeout(function() {
    ShowMoreInfoStockData();
},1000);

我试图在框架中搜索事件,但没有找到任何东西。

标签: gridjs

解决方案


推荐阅读