Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintime-datatable height not allowing for "No records" to display #686

Open
duhmojo opened this issue Jan 2, 2025 · 1 comment
Open

Comments

@duhmojo
Copy link

duhmojo commented Jan 2, 2025

Describe the bug
A straight use of includes a 'height: 100%' but it's not resulting in enough height to display the "No records" icon and text. When table data is loaded the height is reflective of the records.

To Reproduce
In my main.jsx I include the Datatable styling so its in oder of the overall mantine styling:

import '@mantine/core/styles.css';
import '@mantine/notifications/styles.css';
import 'mantine-datatable/styles.layer.css';

Doing so will hide the "No records". If I skip adding the style it'll always show "No records", a common issue people report I expect.

Then in a component I simply import and render DataTable:

            <DataTable
                records={[]}
                columns={[{accessor: 'name', title: 'Name'}, ...]}
            />

When I view the page I thought no records wasn't working, but I noticed a small line in the centre of the table:

image

I went into the DOM and found that the mantine-datatable class had height set to 100%. When I changed it to a specific height it revealed no records was being displayed but the browser wasn't considering the height with the no record content:

image

Expected behavior
No record should be displayed/visible as expected.

Screenshots
See above.

Desktop (please complete the following information):

  • OS: Macos
  • Browser Chrome
  • Version 131
@duhmojo
Copy link
Author

duhmojo commented Jan 2, 2025

I worked around it by adding a dynamic height prop height={images.length > 0 ? '100%' : '180px'}. I'll have to create a DataTable wrapper to keep this workaround because I won't be sprinkling it all over the place for each table use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant