Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

Dynamic ListGroup Display

Hello - I’m new to DASH. My dropdown when selected is dynamically creating a ListGroup of ListGroupItems.

  • After selecting the dropdown value “Group A” the following code is generated.

dbc.ListGroupItem(“Beneficiary Charity Organization”, href=“https://example.com:1008/ibm/iis/igc-rest/v1/assets/6662c0f”, target="_blank"),
dbc.ListGroupItem(“Member Donation”, href=“https://example.com:1008/ibm/iis/igc-rest/v1/assets/6662c0f2”, target="_blank"),
dbc.ListGroupItem(“Matching Gift Contribution”, href=“https://example.com:1008/ibm/iis/igc-rest/v1/assets/6662c0f2”, target="_blank")])

How do I get this code to render within the layout?
… It currently just shows as a string.

Thank you

I switch my approach and used “html.P” and “html.A” tags … adding the “pre-wrap” to get them to show on separate lines.

dtstGroup = [html.P(
html.A(row[‘name’], href=row[’_url’], className=‘dataset’, id=‘dtst’ + str(index))
, style={‘whiteSpace’: ‘pre-wrap’}, id=str(index)
for index, row in datasets.iterrows()]

My mistake was trying using ‘listGroup’ strings to concatenate the DataFrame, instead of just using the component listGroup in the loop…

Hope this helps someone… :wink:

@SP123 can you please share your entire code here? I am struggling and can’t totally get the callback right