I’ve been loving the dash_table_experiments
, and I’m looking for one last feature to make it fully match my use case: embedding links in cells. I know there’s been a lot of work to enable components as cells, and that it’s dependent on work being done on a render
component prop, but I’m wondering if there’s any workaround I could potentially use now to dynamically populate cells with links.
For example, when I run the following, I (predictably) get Error loading layout
because Objects are not valid as a React child (found: object with keys {type, namespace, props}).
:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import dash
import dash_table_experiments as dt
import dash_html_components as html
app = dash.Dash()
app.css.append_css({"external_url":
"https://codepen.io/chriddyp/pen/bWLwgP.css"})
def main():
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')
links = [html.A('Navigate to "/{}"'.format(a), href='/{}'.format(a))
for a in range(df.shape[0])]
df['links'] = pd.Series(links, index=df.index)
return dt.DataTable(rows=df.to_dict('records'),
columns=df.columns,
filterable=True,
sortable=True,
selected_row_indices=[],
)
app.layout = html.Div(main(), style={
'width': '100%',
'maxWidth': '1200px',
'margin': '0 auto'
})
if __name__ == '__main__':
app.run_server(debug=True)
How might I find a workaround to put links in cells?