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

[TableRow] does NOT remain select when showing Drawer on TableRow select #4738

Closed
davidruisinger opened this issue Jul 18, 2016 · 10 comments
Closed
Labels
component: table This is the name of the generic UI component, not the React module!

Comments

@davidruisinger
Copy link

Problem description

I have a table where I show some items and a click on the item reveals a Drawer with the item details. Unfortunately the selected row instantly get's deselected when the Drawer ist shown.

Steps to reproduce

  1. Create a Table with selectable={true} and onRowSelection={myOnSelectFunction}
  2. I also added deselectOnClickaway={false} to TableBody
  3. In the myOnSelectFunction show a Drawer
    ==> Drawer is shown BUT selected Row gets deselected right away

Expected behavior

...
==> Drawer is shown AND selected row remains selected. (So I can update the details if another item is selected or deselect the row when Drawer is dismissed)

Versions

  • Material-UI: "0.15.2"
  • React: "15.2.1"
  • Browser: Chrome 51.0.2704.103
@debslab
Copy link

debslab commented Jul 19, 2016

I am also facing same issue. If you don't do any state update in callback function, it stays selected. But if we change state, then selection is unchecked.

@mpontikes mpontikes mentioned this issue Aug 5, 2016
13 tasks
@siegesmund
Copy link

Facing the same issue, as described above.

@dotnwat
Copy link

dotnwat commented Oct 28, 2016

I'm seeing something similar. If I have any onRowSelection callback defined and I do anything like modifying state in the callback then the row is not selected, but the callback is fired. The row is selected if I click on it again.

@Rhywden
Copy link

Rhywden commented Dec 11, 2016

This is also true if you dispatch an action through Redux and modify some completely unrelated state which shouldn't be of any interest to the table (because, frankly, I didn't write the code yet which uses that state).

Also: This worked in 0.15.1

@Rhywden
Copy link

Rhywden commented Dec 11, 2016

Okay: Follow-up: ANY kind of state change will reset the table. Even when said state change is done by completely unrelated components and does not change the UI at all

This makes the Table completely unusable.

@Rhywden
Copy link

Rhywden commented Dec 11, 2016

Also: The SelectAll is not affected by this. If I hit SelectAll and then change the state, all rows will stay selected.

@Rhywden
Copy link

Rhywden commented Dec 11, 2016

Okay, figured it out, at least for me: You must isolate the table completely and utterly into its own component. Then you only pass static props into this component.

Because as soon as one of those props changes, even if it isn't anywhere near related to anything the table uses and even if the prop doesn't actually change anything in the UI, your table will reset.

@oliviertassinari oliviertassinari added the component: table This is the name of the generic UI component, not the React module! label Dec 18, 2016
@oliviertassinari oliviertassinari changed the title TableRow does NOT remain select when showing Drawer on TableRow select [TableRow] does NOT remain select when showing Drawer on TableRow select Dec 18, 2016
@rachel-singh
Copy link

Ah I have the same issue. As soon as I try to do something in the onRowSelected callback the row gets unselected. If I do nothing in the callback it all works fine.

@Rhywden
Copy link

Rhywden commented Dec 21, 2016

Again: Isolate the table thus that the table state is not changed through the selection. I.e. you need to use something like Redux to notify other components of table changes.

@oliviertassinari
Copy link
Member

We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. While we haven't tested it, I think that the issue is most likely fixed on that branch. Hence, I'm closing it.
Still, we will accept PR fixes until v1-beta takes over the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

7 participants