Mui-datatables: Why does the table have a max height when responsive is set to scroll?

Created on 10 Jul 2019  路  9Comments  路  Source: gregnb/mui-datatables

When setting the option responsive to scroll, the table automatically gets a max-height of 499px, why is that?

The reason I'm asking, is because I want to disable it, but it seems very intentional (see highlight below), so I'm afraid there's some side-effect to disabling it that I'm missing.

https://github.com/gregnb/mui-datatables/blob/330026f7053c9f92b61ef8bc89504fc883f30408/src/MUIDataTable.js#L32

The max-height also seems to cause quite a lot of confusing elsewhere: https://github.com/gregnb/mui-datatables/issues/614, https://github.com/gregnb/mui-datatables/issues/580, https://github.com/gregnb/mui-datatables/issues/630, https://github.com/gregnb/mui-datatables/issues/234#issuecomment-463101548, https://github.com/gregnb/mui-datatables/issues/409, https://github.com/gregnb/mui-datatables/issues/378, https://github.com/gregnb/mui-datatables/issues/310

Workaround

See https://github.com/gregnb/mui-datatables/issues/378#issuecomment-458112410

new feature

Most helpful comment

Yes, exactly, I was thinking an additional option to the responsive option. Options would be like this:

  • stacked: Unchanged from the original
  • scrollMaxHeight: Would be the option matching the original scroll, but changed in name for clarity
  • scrollFullHeight: Would do out of the box what you and many others are looking for, where there is no max height set
  • scroll: The default scroll option with max height set, as it is today. We would keep this for now, for the sake of backwards compatibility, but add a deprecation warning.

All 9 comments

The principle reason to do this, in my view, is that it helps to make it clear that there is additional off-screen data when it overflows the page. This is a particularly bad UX issue when horizontal scrolling is needed also for a large numbers of columns, as it is very difficult to see that there is missing data, since the scrollbar will appear only at the bottom if there is no max-height, and may easily be missed by users.

It is easy to override this behavior, so I don't see that it is too much cause for concern, for those who wish to opt out of safer UX behavior or add their own behaviors.

I would consider reviewing an additional option to determine whether or not there is a max height set on scroll, if you want to work on that, but I don't want to change the default behavior at this point to avoid unnecessary breakage.

Okay, that makes sense.

I would consider reviewing an additional option to determine whether or not there is a max height set on scroll, if you want to work on that...

Can you elaborate on this, I'm not quite sure I follow? Are you suggesting another value to the responsive option, (like scroll-full), that works the same way as scroll, but without setting the max-height?

Yes, exactly, I was thinking an additional option to the responsive option. Options would be like this:

  • stacked: Unchanged from the original
  • scrollMaxHeight: Would be the option matching the original scroll, but changed in name for clarity
  • scrollFullHeight: Would do out of the box what you and many others are looking for, where there is no max height set
  • scroll: The default scroll option with max height set, as it is today. We would keep this for now, for the sake of backwards compatibility, but add a deprecation warning.

Yeah that makes sense. I'll see if I get time to create a PR some times, otherwise anyone else is free to pick this up. (good candidate for a first time issue)

Is there any news?

@suren1525

I'm not working on this currently, and I don't believe anyone else is.

In the mean time, you can see https://github.com/gregnb/mui-datatables/issues/378#issuecomment-458112410 for a workaround

@JReinhold

Thank you for your prompt reply.

I'll take this on for the next release.

Was this page helpful?
0 / 5 - 0 ratings