✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

DataTable - Row Height

Is there a way to shrink the row height, i.e. – reduce the top / bottom padding between cell contents and row top / bottom border to give it more of an Excel feel?

I’ve made multiple attempts to achieve this outcome using changes to padding and borders etc. without success. The row height would not shrink below 30px.

The solution that finally worked for me was this:

css=[{‘selector’: ‘.dash-spreadsheet tr’, ‘rule’: ‘height: 10px;’}],

1 Like

Thanks for this tip. Works like a charm. And if you want to distinguish between table
header and body you can even do that:

    css=[
        {"selector": ".dash-spreadsheet tr th", "rule": "height: 15px;"},  # set height of header
        {"selector": ".dash-spreadsheet tr td", "rule": "height: 75px;"},  # set height of body rows
    ]
1 Like