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

Edit row (without cancelling or completing) sticks when rerendering component. #1093

Closed
Totalbug92 opened this issue Sep 11, 2019 · 4 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@Totalbug92
Copy link

Describe the bug
I have a parent component where you can choose between displaying different tables(as child components). If i click edit on a row, and then switch to view another table, and then switch back to the original table, the editRow is still active. It also bugs out allowing me to interact with the rest of the table.

This may be just me programming the view in a poor way, so if anyone has a smart way to switch between tables and rerender their state completly don't hesitate to tell me.

To Reproduce
Described above

Expected behavior
To either have editRow still be in progress, with rest of table disabled. Or when coming back to original table refresh it without any edit rows still being in progress.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 76.0.3809.132
@Totalbug92
Copy link
Author

Totalbug92 commented Sep 13, 2019

A fix that worked in my application(Using typescript):

create a ref in constructor
public MTRef: any = React.createRef()

add tableRef prop to MaterialTable
tableRef={this.MTRef}

add this to componentDidMount

if(this.MTRef.current !== null){

  this.MTRef.current.state.data.forEach(element => {

    if(element.tableData.hasOwnProperty('editing')){

      delete element.tableData.editing
    }
  });
}

@jayarjo jayarjo added the bug Something isn't working label Sep 28, 2019
@jayarjo
Copy link

jayarjo commented Sep 28, 2019

I guess the proper behavior in this case will be to have edit row component active/visible, but having the rest of the table inactive/disabled.

@jayarjo jayarjo self-assigned this Sep 28, 2019
@Domino987
Copy link
Collaborator

Domino987 commented Oct 13, 2019

I think this will be fixed with #1174 . When my PR is through, can you test it again?
and @Totalbug92, I hope you will not have to use this hotfix anymore.

@stale
Copy link

stale bot commented Jun 15, 2020

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.

@stale stale bot added the wontfix This will not be worked on label Jun 15, 2020
@stale stale bot closed this as completed Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants