The Wayback Machine - https://web.archive.org/web/20200708023709/https://github.com/gregnb/mui-datatables/pull/958
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

Add a loading option #958

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@joshleblanc
Copy link

joshleblanc commented Sep 25, 2019

This adds a loading option to the table. It defaults to false.

When true, it adds a loader on top of the current table.

ZnjLHg3p3n

This is to facilitate server-side data loading.

@coveralls
Copy link

coveralls commented Sep 25, 2019

Coverage Status

Coverage increased (+0.08%) to 76.715% when pulling 9107a9a on joshleblanc:custom-table-body into f0ea9e5 on gregnb:master.

@joshleblanc joshleblanc force-pushed the joshleblanc:custom-table-body branch from ed615c7 to 9107a9a Sep 25, 2019
@loktar00
Copy link

loktar00 commented Sep 25, 2019

The same can be accomplished (visually) by providing a loader (custom ect.) Right before <MUIDataTable/>

Quick dirty example using the serverside pagination example, as an example.

const loadingComponent = (
      <div style={{position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)'}}>
        <CircularProgress size={24} />
      </div>
    );

    return (
      <div style={{position:'relative'}}>
        {isLoading && loadingComponent}
        <MUIDataTable title={<Typography variant="title">
          ACME Employee list
          </Typography>
          } data={data} columns={columns} options={options} />
      </div>
    );
@gabrielliwerant
Copy link
Collaborator

gabrielliwerant commented Sep 25, 2019

This isn't a feature that I think should be supported at this time. It has come up a few times (Eg: #361 & #466). It's easy enough to add this in and around the table without making it core functionality (see serverside-pagination example).

The library needs to leave out some things to keep it from becoming bloating and overcomplicated. When it comes to additional component rendering, I think it's best left to custom renders or author-provided functionality.

@anthonywebb
Copy link

anthonywebb commented Oct 3, 2019

@gabrielliwerant it would be helpful in your serverside-pagination example if the loading indicator placement was not covered/hidden by the search box. Sure adding it outside the "paper" works, but does not feel right. I think a useful example of this as the example you reference attempts to be would be a good starting point for those wanting to elegantly add a loading indicator.

@gabrielliwerant
Copy link
Collaborator

gabrielliwerant commented Oct 3, 2019

@anthonywebb Agreed, the examples provided are not the best. Would you have any interest in submitting something to enhance the example? I created an issue for this and linked it here.

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

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.