-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-core.py
36 lines (29 loc) · 809 Bytes
/
app-core.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
28
29
30
31
32
33
34
35
36
from itables.sample_dfs import get_dict_of_test_dfs
from itables.shiny import DT, init_itables
from shiny import App, render, ui
dfs = get_dict_of_test_dfs()
app_ui = ui.page_sidebar(
ui.sidebar(
ui.input_select(
"table_selector",
"Table",
choices=list(dfs.keys()),
selected="int_float_str",
)
),
ui.HTML(init_itables()),
ui.output_ui("my_table"),
ui.markdown("Selected rows"),
ui.output_code("selected_rows"),
title="Using DT in a Shiny App",
fillable=True,
)
def server(input, output, session):
@render.ui
def my_table():
"""
This function renders the table using "DT".
"""
df = dfs[input.table_selector()]
return ui.HTML(DT(df))
app = App(app_ui, server)