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

Hiden sorting lable in the actions header

Open GachaSalt opened this issue 7 years ago • 4 comments

Problem: I found that there is a hiden sorting lable lies within the acitions header and can not be removed. In most cases, it's fine, but it prevents me from properly aligning (especially aligning centrally) the contents of the action column, which is a problem to me.

Solution: In the m-table-header.js, the actions header is rendered by

 key: "renderActionsHeader",
    value: function renderActionsHeader() {
      var localization = (0, _objectSpread2["default"])({}, MTableHeader.defaultProps.localization, this.props.localization);
      return React.createElement(_core.TableCell, {
        key: "key-actions-column",
        padding: "checkbox",
        className: this.props.classes.header,
        style: (0, _objectSpread2["default"])({}, this.props.headerStyle, {
          textAlign: 'center'
        })
      }, React.createElement(_core.TableSortLabel, {
        disabled: true
      }, localization.actions));
    }

This problem could be temporarily solved by replacing the React.createElement(_core.TableSortLabel, {disabled: true}, localization.actions) with React.createElement('div', null, localization.actions). For a long term solution, I hope this hiden sorting label could be removed permanently or optionally in the future.

Thank you for your great work on this useful project.

GachaSalt avatar Jun 10 '19 15:06 GachaSalt

Hi @GachaSalt

I will consider this. Thanks for your clear description.

mbrn avatar Jun 13 '19 07:06 mbrn

@GachaSalt did you find any work arounds for this? I am facing the same alignment problems as you.

@mbrn any updates? There's a prop called hideSortIcon that you can add to TableSortLabel and it will hide the icon until sort is active. https://v3.material-ui.com/api/table-sort-label/#tablesortlabel-api

buhrenduh avatar Feb 26 '20 20:02 buhrenduh

@buhrenduh I'm facing the same issue. Did you manage to find a workaround?

eloyrubinos avatar May 01 '20 07:05 eloyrubinos

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 30 '20 07:07 stale[bot]