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

Allow specifying component for Typography in case of no matches #1403

Closed
Aankhen opened this issue Jul 10, 2020 · 3 comments
Closed

Allow specifying component for Typography in case of no matches #1403

Aankhen opened this issue Jul 10, 2020 · 3 comments

Comments

@Aankhen
Copy link

Aankhen commented Jul 10, 2020

Expected Behavior

With irrelevant options elided, this:

<MUIDataTable
        title={title} 
        columns={columns}
        options={{
            textLabels: {
              noMatch: <CircularProgress size={24} style={{marginLeft: 15, position: 'relative', top: 4}} />,
            }
            noMatchTypographyComponent: "div",
        }}
        data={tableRows}
      />

Results in this when there are no matches:

<Typography component="div">
   <CircularProgress size={24} style={{marginLeft: 15, position: 'relative', top: 4}} />
</Typography>

Which gives us a structure like:

<div>
  <div>…</div>
</div>

Which, while a little unnecessary, is valid.

Current Behavior

With irrelevant options elided, this:

<MUIDataTable
        title={title} 
        columns={columns}
        options={{
            textLabels: {
              noMatch: <CircularProgress size={24} style={{marginLeft: 15, position: 'relative', top: 4}} />,
            }
            noMatchTypographyComponent: "div",
        }}
        data={tableRows}
      />

Results in this when there are no matches:

<Typography>
   <CircularProgress size={24} style={{marginLeft: 15, position: 'relative', top: 4}} />
</Typography>

Because Material UI’s CircularProgress wraps its contents in a div, this gives us a structure like:

<p>
  <div></div>
</p>

Which causes a DOM nesting validation error.

Your Environment

Tech Version
Material-UI 4.9.12
MUI-datatables 3.0.0
React 16.13.0
browser Chrome 83
@patorjk
Copy link
Collaborator

patorjk commented Jul 10, 2020

Thank you for the report. I've put a fix for this in v3.2.0, which should come out next week and is available in beta here:

npm install mui-datatables@v3.2.0-beta.0

@Aankhen
Copy link
Author

Aankhen commented Jul 11, 2020

That was so quick! Thank you very much.

@patorjk
Copy link
Collaborator

patorjk commented Jul 16, 2020

Fixed in version 3.2.0

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

2 participants