Material-table: Unnecessary Table padding on the selection of pagination

Created on 25 Feb 2020  路  7Comments  路  Source: mbrn/material-table

Describe the bug
Table padding is goes on increasing without the data body on the selection of pagination

Could it possible to limit the increasing or fix the body data padding on selection of any pagination row data.
I have 3 records, if i choose 20 row selection, i want to limit the fixed body size.
materialTable

wontfix

Most helpful comment

@chetankumars there's an emptyRowsWhenPaging property in the table options that controls whether the empty rows are rendered or not. It defaults to true so setting it to
options={ ...otherOptions, emptyRowsWhenPaging: false, }

should fix the issue.

All 7 comments

You can modify maxBodyHeight and minBodyHeight inside options props given to material table. Example:

<MaterialTable 
    columns = {yourColumns}
    data = {yourData}
    options = {maxBodyHeight : 10, minBodyHeight : 10}
/>

This will set max and min body height. And if you want to change it again after getting your data, you could do it through a ternary.

Thank you

@Androsv96 Sorry, but I don't understand how that fixes the issue. The table is expected to resize based on its content. How is it possible to predict the right body height and set it dynamically every time?
@chetankumars can you please reopen this?

I noticed even if you do set the body dimensions, the table makes the content scrollable and still has that extra padding, if you select a number of rows greater than the content that is displayed. You will see the padding when you scroll down the body. This is still a bug.

@chetankumars there's an emptyRowsWhenPaging property in the table options that controls whether the empty rows are rendered or not. It defaults to true so setting it to
options={ ...otherOptions, emptyRowsWhenPaging: false, }

should fix the issue.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

@patrickp-dev Thanks, that helped. It seems silly that this option defaults to true, it definitely looks weird.

Was this page helpful?
0 / 5 - 0 ratings