Skip to content

Conversation

@jrassa
Copy link
Contributor

@jrassa jrassa commented Jun 12, 2025

  • Add option to enable/disable 'Unpin all'. Enabled by default.
  • Add new 'Reset pins' action that restores pinning to initial state.
  • Add option to enable/disable 'Reset pins' action. Disabled by default.

@vercel
Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
material-react-table Error Error Oct 1, 2025 0:19am
material-react-table-storybook Ready Ready Preview Comment Oct 1, 2025 0:19am

* Add option to enable/disable 'Unpin all'.  Enabled by default.
* Add new 'Reset pins' action that restores pinning to initial state.
* Add option to enable/disable 'Reset pins' action.  Disabled by default.
{localization.resetPins}
</Button>
)}
{enableHiding && (
Copy link

@MichaelDimmitt MichaelDimmitt Dec 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer, I have no merging power but hopefully this gets the discussion going.

Recently, I had to solve for this myself in a custom override.
renderToolbarInternalActions - there was no renderShowHideColumnMenuHeader tie in so I used renderToolbarInternalActions and copied a lot of the existing functionality and changed what I needed to move forward.

Here are some notes on this pr:

  1. The code looks correct.
  2. The vercel deployment is failing not sure if that is why the pr is sitting. I took a look but was unable to see the deployment logs they might not be public.
  3. Does the additional item in the show hide menu row make it look cramped? Adding a screenshot here could help I might add one of your version in a bit.
  4. This MRT_ShowHideColumns menu does multiple actions therefore does it make sense to have a general reset to default states for all actions? In my implementation I have commented out all of the other sections and just have the following generic reset:
{enableColumnPinning && (
  <Button
    disabled={!getIsSomeColumnsPinned()}
    onClick={() => {
      table.setColumnVisibility(table.initialState.columnVisibility);
      table.resetColumnPinning();
      table.setColumnOrder(getDefaultColumnOrderIds(table.options, true)
    }}
    style={{ marginRight: '1.75rem', float: right }}
  >
    Reset
  </Button>
)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: @jrassa, @KevinVandy. the build is failing because all of the locale's have not been updated:

reproduce via pnpm install; pnpm run build
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Column Pinning Initial" storybook was updated to enable this option so it is good place to see how it looks. It doesn't look cramped, but the menu is wider with the extra option.

https://material-react-table-storybook-enlqhvzt5-kevinvandy-s-team.vercel.app/?path=/story/features-column-pinning-examples--column-pinning-initial

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, I did not think to look at the storybook preview. thanks

Copy link

@MichaelDimmitt MichaelDimmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build failing because not all locales have been updated.

@jrassa
Copy link
Contributor Author

jrassa commented Dec 28, 2025

build failing because not all locales have been updated.

Not sure the proper way to fix this. I could fill in each with the english value, but that feels wrong as it already falls back to the EN local.

The proper solution would probably be to update the types in the locales definitions. I see two possible approaches:

  1. change the type of the local definitions to Partial<MRT_Localization> to reflect that they don't have to be complete.
  2. change the type to `'Omit<MRT_Localization, 'resetPins'> to more explicitly indicate the missing keys for each localization.

I can update to do either approach.

Any insight @KevinVandy?

@MichaelDimmitt
Copy link

I was thinking a third option to what you suggested could be do a google translate on the key in various languages.
put a comment on each locale showing that it was auto generated and might be inaccurate.

find a way to make adding that as easy as possible possibly with a command line tool. @jrassa
I put some time in today to come up with that solution since it seemed a chore to manually do this in all the various languages.

@MichaelDimmitt
Copy link

MichaelDimmitt commented Dec 29, 2025

@jrassa @KevinVandy , I pointed a pr on top of this one that did a best effort at adding those locales to fix the build.
jrassa#1 - if it gets merged this pr would be updated.

This just gives that option if you guys want the build fixed.
There are some comments in there on how it was generated.

@MichaelDimmitt
Copy link

A last option would be to add a new tie in: renderShowHideColumnMenuHeader
I should have a pr up tomorrow morning. Not related to this pinning but in terms of adding tab accessibility to the show hide menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants