material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Selecting row hides toolbar action menu

Open Dwight-D opened this issue 7 years ago • 12 comments

Describe the bug When rows are selected, the toolbar.nRowsSelected message blocks the toolbar action menu. Even when options.showTextRowsSelected is false the toolbar menu still disappears, even though no message blocks it.

To Reproduce Steps to reproduce the behavior:

  1. Enable selection and disable selection text in options prop:
const options = {
      selection: true,
      showTextRowsSelected: false,
...
  1. Notice that toolbar action menu is shown
  2. Select one or more rows
  3. Notice how toolbar menu disappears

Expected behavior Toolbar should stay regardless of row selection. Possibly add additional option to force toolbar to stay on top, even if selection message is present (show both message and toolbar if there is space in the header).

Screenshots No selection: image

With selection and no selection message: image

Desktop (please complete the following information):

  • OS: MacOS Mojave
  • Browser: Firefox Developer Edition, version 69.0b11 (64-bit)

Dwight-D avatar Aug 13 '19 12:08 Dwight-D

Any update on this? It's a pretty annoying bug

bableves avatar Dec 20 '19 11:12 bableves

@mbrn can you please take a look at this?

  • Is this a bug or does it work as designed?
  • Any suggestion how to make actions work with selections would be helpful

pixelass avatar Feb 05 '20 19:02 pixelass

It seems like a bug. I will take a look it. But I prioritize the issues according to their reaction count. Please take a look at readme

mbrn avatar Feb 05 '20 19:02 mbrn

Thank you for the fast reply. I need this feature but can use something custom until it's fixed. I might look into it and try to open a PR if I can get it to work.

pixelass avatar Feb 05 '20 19:02 pixelass

I'm not sure if this helps the other reporters. In my case I was able to find some undocumented feature (I might also be blind) to support my desired behavior.

actions={[{
    icon: 'edit',
    tooltip: 'Edit',
    position: "toolbarOnSelect",
    onClick: () => {
        console.log('Clicked edit action')
    }
}]}

This will show the action in the toolbar only if one or more rows are selected which is exactly what I was trying to achieve.

material-table

pixelass avatar Feb 06 '20 09:02 pixelass

Up. After some searching and overrides attemps, I still cannot figure how change the "showTextRowSelected"... we can only set the prop true/false

corneliugaina avatar Feb 06 '20 11:02 corneliugaina

@corneliushka showTextRowsSelected is a boolean option. I'm not sure how your question relates to this issue.

You can set showTextRowsSelected to false if you want to disable the text "[n] rows selected" which works as designed

notice how the title stays in place compared to the gif I posted earlier

material-table_2

pixelass avatar Feb 06 '20 11:02 pixelass

Sorry I wrongly explained myself; I want to change color (pink to grey) & the text x row(s) selected, but I don't know how. showTextRowsSelected is the only prop I found that's related to this...

corneliugaina avatar Feb 06 '20 13:02 corneliugaina

@corneliushka This is absolutely unrelated to this issue. Please make sure you don't spam other issues. If you notice a bug, please open an issue (look for existing issues) if you need help please consider other platforms like Stackoverflow which has more activity and a faster reply-rate.

You can find examples on styling here: https://material-table.com/#/docs/features/styling

no need to answer to this comment, thank you.

pixelass avatar Feb 06 '20 16:02 pixelass

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[bot] avatar Jul 05 '20 16:07 stale[bot]

2021 and we still have this bug, did anyone get this working?

By working I mean setting the showTextRowsSelected to false and the toolbar buttons would still be visible regardless if there are checkboxes selected or not.

Also, I don't understand how this is marked as "wontfix" this is clearly a bug and a very common requirement.

Thanks

EdwinCloud101 avatar Mar 06 '21 05:03 EdwinCloud101

@sr2399 I identified the issue, I consider that a bug and sent a PR to the material-table repo. You might want to take a look, hoping it gets approved soon.

https://github.com/mbrn/material-table/pull/2809

EdwinCloud101 avatar Mar 17 '21 19:03 EdwinCloud101