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.2.0.tar.gz (119.4 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.2.0-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spaday_regular_table-0.2.0.tar.gz
  • Upload date:
  • Size: 119.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 14142dd77ef8046b8dd638aa8f010f696048ce700ed074ef17eb62b263bf8ce3
MD5 9557e9b06f7d8f7359e31f8c2ae7c1e5
BLAKE2b-256 5fe2babc727d8105d83ee1e5ba26df9362e9c0ffa3ce9a0b6309a3270344f585

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for spaday_regular_table-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2518ce541994b346afe60957fa0b5a718c2ee7eb70fbda52b0a2890cbfaeeb30
MD5 8a3c961593753c33759026dac493397f
BLAKE2b-256 d1cbd12d50b4df398f6cf405da595b03a6c6cf974d8f77348c299abcfe94470d

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