Skip to content

put_datatable() doesn't work #687

@wang0618

Description

@wang0618

There is an issuse on the CDN used by pywebio, causing put_datatable() shows "⌛️ Loading Datatable..." forever.

To solve this problem, you can use the following workaround to change the CDN source. A new release will be coming soon to officially fix this issue.

import json
import urllib.request

import pywebio
from pywebio.output import put_datatable


def main():
    pywebio.session.run_js(
    """
    require.config({
        paths: {
            "ag-grid": "https://cdn.jsdelivr.net/npm/ag-grid-community@28.2.1/dist/ag-grid-community.min",
            "ag-grid-enterprise": "https://cdn.jsdelivr.net/npm/ag-grid-enterprise@28.2.1/dist/ag-grid-enterprise.min",
        },
    });
    """
    )

    with urllib.request.urlopen("https://fakerapi.it/api/v1/persons?_quantity=30") as f:
        data = json.load(f)["data"]

    put_datatable(data)


if __name__ == "__main__":
    pywebio.start_server(main, port=8080)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions