Skip to main content

spaday-regular-table

Viewport-virtualized data tables for spaday, powered by regular-table.

Build Status codecov License PyPI

Documentation

Quick example

from spaday import CallEndpoint, event_value, serve
from spaday_regular_table import RegularTable

rows = [{"id": i, "symbol": f"SYM{i}", "price": i / 10} for i in range(100_000)]

table = RegularTable(
    columns=[
        "id",
        {
            "key": "symbol",
            "label": "Symbol",
            "cell": {"tag": "button", "class": "symbol-button", "event": "symbol-click"},
        },
        {"key": "price", "label": "Last price", "cell": {"format": "number", "digits": 2}},
    ],
    rows=rows,
    row_header="id",
    style="height: 32rem",
).on("symbol-click", CallEndpoint("POST", "/api/click", event_value()))

serve(table, packages=["regular-table"])

Only cells requested for the current viewport are copied into regular-table and rendered. rows remains a browser-side record array. columns accepts keys or {key, label, cell} objects and is inferred from the first row when omitted. A cell descriptor can wrap the displayed value in an HTML or custom-element tag, apply classes and attributes, or format numeric values. The wrapper performs that work only for visible cells.

For hot server pushes, set stream_url to an SSE endpoint whose messages are row patches. You can also bind rowPatch to CallEndpoint(result=...) state for request/response updates. Each patch contains revisioned update, insert, and remove operations, so a 100,000-row list is not recopied. The browser methods remain available to integration authors, but applications need no JavaScript callback.

cell-click exposes event.detail with type, virtual x/y, column, value, and the source row, so normal spaday actions can handle interactions. virtual_mode supports upstream both, horizontal, vertical, and none; keep both for large datasets.

Run the local example

python -m pip install -e ".[examples]"
python -m spaday_regular_table.example

Open http://127.0.0.1:8014 to inspect the complete market-blotter example: 100,000 virtualized rows, a server row stream, full-width sizing, rich cells, and server-authoritative update, insert, remove, and click operations. All interaction is authored in Python; there is no companion example.js. It passes the local package descriptor directly, so it does not install or resolve the integration from GitHub.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spaday_regular_table-0.1.0.tar.gz (119.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spaday_regular_table-0.1.0-py3-none-any.whl (83.0 kB view details)

Uploaded Python 3

File details

Details for the file spaday_regular_table-0.1.0.tar.gz.

File metadata

  • Download URL: spaday_regular_table-0.1.0.tar.gz
  • Upload date:
  • Size: 119.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for spaday_regular_table-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8ae3dc0349e037111dc11474ad5b08d11f70d8915ebd8eb3e61af054c7fd22b7
MD5 3cbc1585b4c25f30ddd7b62d9fbfef0f
BLAKE2b-256 db5a796b67e3870268395c1716d2adefeeb4017d2f67de264bc1fa4a76ff36a5

See more details on using hashes here.

File details

Details for the file spaday_regular_table-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spaday_regular_table-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae36a6b235ad86cf30106f8c96b3121871a59f28224efb6af31b6ad29829e7a
MD5 e1884eca06186a9b47c03b235ba735c4
BLAKE2b-256 ec1947a75d8860aba08327930280096faf0db0c85aec23f546fb3e15935d79ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page