Buttons Column
How to add buttons to the rows of a table
def create_modal(name: str):
shimoku_client.plt.set_modal(name)
shimoku_client.plt.html(f"<h1>{name}</h1><p>Modal content</p>", order=0, cols_size=12)
shimoku_client.plt.pop_out_of_modal()
# Creating models for demonstration
for name in ["Modal 1", "Modal 2", "Modal 3"]:
create_modal(name)
# Table data with dates and associated modals
table_data = [
{"date": dt.date(2021, 1, 1), "modal": "Modal 1"},
{"date": dt.date(2021, 1, 2), "modal": "Modal 2"},
{"date": dt.date(2021, 1, 3), "modal": "Modal 3"},
{"date": dt.date(2021, 1, 4), "modal": "Modal 1"},
{"date": dt.date(2021, 1, 5), "modal": "Modal 2"}
]
# Configuring and displaying the table
shimoku_client.plt.table(
data=table_data,
order=0,
rows_size=3,
buttons_column_definition=shimoku_client.plt.TableButtonColumnDefinition(
column_name="Buttons",
label="Open Modal",
models_column="modal"
),
columns_options={"Buttons": {"width": 150}}
)
Last updated
Was this helpful?


