【问题标题】:Load data from a remote URL not working with BT5从无法使用 BT5 的远程 URL 加载数据
【发布时间】:2023-04-06 22:39:01
【问题描述】:

我正在尝试通过设置data-url="" 从远程 URL 加载数据。一切都适用于 Bootstrap v4,但是当我使用最新版本的 Bootstrap (v5.0.1) 时,没有加载数据。

我尝试了不同的选项:只有带有 Popper 的 Bootstrap Bundle、带有 Popper 的 jQuery + Bootstrap Bundle 或单独的脚本解决方案,但似乎没有任何效果。

<table 
    id="table" 
    data-toggle="table" 
    data-url="http://satico.beget.tech/json/google-apps-script.json" 
    >
    <thead>
        <tr>
            <th data-field="id">Parent ID</th>
            <th data-field="title">Parent Title</th>
            <th data-field="children[*].guid">Guids</th>
        </tr>
    </thead>
</table>

我的测试页面http://satico.beget.tech/lib-bootstrap-table.html

我的数据http://satico.beget.tech/json/google-apps-script.json

将 Bootstrap Table 添加到 Bootstrap v5 https://bootstrap-table.com/themes/bootstrap5/的入门

【问题讨论】:

    标签: json bootstrap-table bootstrap-5


    【解决方案1】:

    问题是来自http://satico.beget.tech/json/google-apps-script.json 的数据正在返回单个对象而不是数组。 Bootstrap Table 要求来自 data-url 的数据是 JSON 数组。

    Working demo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多