I’m using this data:
data = {"domains": {}}
data["domains"]["www.somedomain.com"] = {"status": "Editing"}
data["domains"]["www.otherdomain.com"] = {"status": "Disabled"}
This table generation function:
def generate_table(dataframe, max_rows=10):
rows = []
header = [html.Tr(children=[
html.Th("Domain"),
html.Th("Status"),
], id='header')]
for domain,info in data["domains"].items():
status = "Unregistered"
if "status" in info:
status = info["status"]
rows.append(
html.Tr(children=[
html.Td( html.Strong(domain,style={'padding': pad})),
html.Td( dcc.RadioItems(
options=[
{'label': 'Unregistered', 'value': 'Unregistered'},
{'label': 'Registered', 'value': 'Approval'},
{'label': 'Editing', 'value': 'Editing'},
{'label': 'Edited', 'value': 'Edited'},
{'label': 'Disabled', 'value': 'Disabled'}
], value=status, labelStyle = { 'display': 'inline-block', 'padding': pad}, style={'display': 'inline', 'width': '10%', 'padding': pad})),
]))
table = html.Table(header + rows, id="table")
return table
And this layout:
app.layout = html.Div([
html.Div(children=[
generate_table(data)
],style={'columnCount': 1}),
html.Div(id='mydiv')
], style={'margin': '30px', 'columnCount': 1})
I’m trying to make it so changing the radio selection in a row updates that element’s status
in the data.
I tried a few different methods, the latest one is having the callback argument be *inputs, and generating a list of inputs including both the radio elements themselves (to trigger the callback), and the row, in order to get the relevant data. But this feels very clunky, and it’s not letting me isolate which row’s radio was specifically clicked.
Help??