This is a Python package that provides a simple way to create tables using the Tabulator library. It is built on top of the NiceGUI library.
Project description
NiceGUI Tabulator
This is a Python package that provides a simple way to create tables using the Tabulator library. It is built on top of the NiceGUI library.
Installation
pip install nicegui-tabulator
Usage
from nicegui_tabulator import tabulator
from nicegui import ui
tabledata = [
{"id": 1, "name": "Oli Bob", "age": "12", "col": "red", "dob": ""},
{"id": 2, "name": "Mary May", "age": "1", "col": "blue", "dob": "14/05/1982"},
{
"id": 3,
"name": "Christine Lobowski",
"age": "42",
"col": "green",
"dob": "22/05/1982",
},
{
"id": 4,
"name": "Brendon Philips",
"age": "125",
"col": "orange",
"dob": "01/08/1980",
},
{
"id": 5,
"name": "Margret Marmajuke",
"age": "16",
"col": "yellow",
"dob": "31/01/1999",
},
]
table_config = {
"height": 205,
"data": tabledata,
"columns": [
{"title": "Name", "field": "name", "width": 150, "headerFilter": "input"},
{"title": "Age", "field": "age", "hozAlign": "left", "formatter": "progress"},
{"title": "Favourite Color", "field": "col"},
{
"title": "Date Of Birth",
"field": "dob",
"sorter": "date",
"hozAlign": "center",
},
],
}
table = tabulator(table_config).on_event("rowClick", lambda e: ui.notify(e))
def on_sort():
table.run_table_method(
"setSort",
[
{"column": "name", "dir": "desc"},
{"column": "age", "dir": "asc"},
],
)
ui.button("sort", on_click=on_sort)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nicegui_tabulator-0.1.1.tar.gz
(112.7 kB
view hashes)
Built Distribution
Close
Hashes for nicegui_tabulator-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25c22f14d8d588761fb78a47dca4faa1b1ac08c0f91437beeee164cf3df1fe46 |
|
MD5 | 244bb2eb1e5c5c285b755f3fb585d55d |
|
BLAKE2b-256 | 502919053b1546520860edad11f9cee1d667aacc61adf8107edbba3caac52296 |