-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
27 lines (22 loc) · 776 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from itables.sample_dfs import get_dict_of_test_dfs
from itables.shiny import DT, init_itables
from shiny.express import input, render, ui
dfs = get_dict_of_test_dfs()
ui.page_opts(title="Using DT in a Shiny App", fillable=True)
with ui.card():
with ui.layout_sidebar():
with ui.sidebar():
ui.input_select(
"table_selector",
"Table",
choices=list(dfs.keys()),
selected="int_float_str",
)
ui.HTML(init_itables())
@render.ui
def my_table():
"""
This function renders the table using "DT".
"""
df = dfs[input.table_selector()]
return ui.HTML(DT(df, caption="A table rendered with ITable"))