plotly / dash-table-experiments

NO LONGER SUPPORTED - use https://github.com/plotly/dash-table instead
MIT License
174 stars 57 forks source link

How to increase DataTables Height ? (To show more rows) #34

Closed samholt closed 6 years ago

samholt commented 6 years ago

Love your work so far, keep it up!

Would someone be able to help me, increase the visible rows on the screen at one time, such as in the example usage.py.

I've tried adding another kwarg of min_height=1200 (to the DataTable object), however this has no effect of increasing the amount of rows visible (Height of the DataTable). Would you be so kind as to advise how to increase the height of a DataTable / to show more rows on the screen, with perhaps the necessary modifications to usage.py example to illustrate this ?

Thank you so much for your time, Many thanks,

Sam

samholt commented 6 years ago

Also if one were to use a dcc.interval, to update the rows, of the DataTable (Live from another datasource, such as a request from somewhere else), this seems to reset the filtered rows, and sorted rows. Is there a way to persist this the filtered state / sorted state, to filter / sort the new rows in the same way ? Love your work, if you don't have enough time to implement, this, do point me in the right direction to modify, and I will fix these up, and submit a PR.

engstromgustav commented 6 years ago

The setting the min_height property as follows works for me:

dt.DataTable(
    rows=DF_GAPMINDER.to_dict('records'),
    row_selectable=True,
    filterable=True,
    sortable=True,
    min_height=2000,
    selected_row_indices=[],
    id='datatable-gapminder'
)

In order to dynamically adjust it based on a variable number of rows you can do this using a callback:

@app.callback(
    Output(component_id='data-table', component_property='min_height'),
    [Input(component_id='data-table', component_property='rows')]
)
def update_table_min_height(rows):
    return 35*(len(rows)+1)
chriddyp commented 6 years ago

Thanks @engstromgustav !

ptim commented 6 years ago

hmm... @engstromgustav 's solution is not working for me out of the box with v 0.5.4... will keep wiggling...

andreabotti commented 6 years ago

Hi @chriddyp, @engstromgustav solution does not work for me either. Any idea why this may be the case?

gennadyi commented 6 years ago

@andreabotti, @ptim see this PR for latest update on this as far as I know: https://github.com/plotly/dash-table-experiments/pull/41