Ohumeronen
Ohumeronen

Reputation: 2086

Python Dash - Keep columns when scrolling

I have the following code:

import pandas as pd
from dash import Dash, dash_table

df = pd.DataFrame({
    'A': ['test', 'tset'] * 120,
    'B': ['a', 'b', 'c'] * 80,
})

app = Dash(__name__)

app.layout = dash_table.DataTable(
    data=df.to_dict('records'),
    columns=[{'id': c, 'name': c} for c in df.columns]
)

if __name__ == '__main__':
    app.run_server(debug=True)

When I scroll down, the column names disappear. How can I fix the column names? I still want to be able to read the column names when scrolling down.

Upvotes: 0

Views: 1061

Answers (1)

diana18
diana18

Reputation: 120

You can get more information from dash.plotly.com/datatable/height

For your question:

fixed_rows={‘headers’:True}

Upvotes: 1

Related Questions