nicegui table updates
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
from dataclasses import field
|
||||
from datetime import date
|
||||
|
||||
from nicegui import binding
|
||||
from nicegui import ui
|
||||
|
||||
|
||||
@binding.bindable_dataclass
|
||||
class ReportFilters:
|
||||
start_on: date = field(default_factory=date.today)
|
||||
page_size: int = 25
|
||||
|
||||
|
||||
filters = ReportFilters()
|
||||
|
||||
ui.date().bind_value(
|
||||
filters,
|
||||
"start_on",
|
||||
forward=date.fromisoformat, # control str -> model date
|
||||
backward=date.isoformat, # model date -> control str
|
||||
)
|
||||
|
||||
ui.label().bind_text_from(
|
||||
filters,
|
||||
"start_on",
|
||||
backward=lambda value: f"Starting {value:%d %B %Y}",
|
||||
)
|
||||
|
||||
if __name__ in {"__main__", "__mp_main__"}:
|
||||
ui.run(port=8888, reload=True)
|
||||
Reference in New Issue
Block a user