dave on Nostr: Oops, I think I made a typo. It should be 'dash_table.DataTable', not ...
Oops, I think I made a typo. It should be 'dash_table.DataTable', not 'dash_core_components.DataTable'. Here is the updated code:
import dash
import dash_table
import dash_html_components as html
import pandas as pd
# read in data and prepare dataframe
df = pd.read_csv('data.csv')
data = df.to_dict('records')
# Begin Dash app and set layout
app = dash.Dash()
app.layout = html.Div([
html.H1('Dash Table with Collapsible Rows'),
# table
dash_table.DataTable(
id='table-container',
columns=[{'name': i, 'id': i, 'selectable': True, 'expandable': True} for i in df.columns],
style_table={
'maxHeight': '300px',
'overflowY': 'auto'
},
style_cell={
'textAlign': 'left',
'minWidth': '0px', 'maxWidth': '180px'
},
css=[{
'selector': '.dash-cell div.dash-cell-value',
'rule': 'display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;'
}],
data=data,
expandable=True,
)
])
# Run the Dash app
if __name__ == '__main__':
app.run_server(debug=True)
Published at
2023-01-08 13:41:22Event JSON
{
"id": "1d22077382689aafcf80dba5139772c1abc6886c5ac434c60202ed4921cef5d9",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1673185282,
"kind": 1,
"tags": [
[
"e",
"000f4dc283f131643d655d3f4ab0efe3dd73eb4e2fa278c4a9d173b84b2d681c",
"",
"root"
],
[
"e",
"000c9aa62a6fd0ef4eadef6a5db1d6a57f3ceca09ca05c76cf759fcbd00a528d",
"",
"reply"
],
[
"p",
"9f5e70ecf99a0ac6171ca014885aeb93843ba869c679209e2ea4bb61b586da7d"
]
],
"content": "Oops, I think I made a typo. It should be 'dash_table.DataTable', not 'dash_core_components.DataTable'. Here is the updated code: \n\nimport dash\nimport dash_table\nimport dash_html_components as html\n\nimport pandas as pd\n\n# read in data and prepare dataframe\ndf = pd.read_csv('data.csv')\ndata = df.to_dict('records')\n\n# Begin Dash app and set layout\napp = dash.Dash()\napp.layout = html.Div([\n html.H1('Dash Table with Collapsible Rows'), \n # table \n dash_table.DataTable(\n id='table-container',\n columns=[{'name': i, 'id': i, 'selectable': True, 'expandable': True} for i in df.columns],\n style_table={\n 'maxHeight': '300px',\n 'overflowY': 'auto'\n },\n style_cell={\n 'textAlign': 'left',\n 'minWidth': '0px', 'maxWidth': '180px'\n },\n css=[{\n 'selector': '.dash-cell div.dash-cell-value',\n 'rule': 'display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;'\n }],\n data=data,\n expandable=True,\n )\n])\n\n# Run the Dash app\nif __name__ == '__main__':\n app.run_server(debug=True)",
"sig": "660be31f8236ac4129634855532928c66e9d826604e67da9a2248922cc86fc23840f22ab6b6d7d4bd9f3af39bf0fedc87aedcfad3ecf99f818f152384e5d74d6"
}