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

Please add functionality to make multi sort possible

Open SilviaJoycePHMS opened this issue 7 years ago • 6 comments

What is the current behavior? I can only sort for one column. After I click on a second one, it clears the one before.

What is the use-case or motivation for changing an existing behavior? That I can use a multiple sort based on year followed by month as well.

SilviaJoycePHMS avatar Dec 13 '18 21:12 SilviaJoycePHMS

For us this as well this is super important. I hope this gets implemented.

@mbrn Thank you and everyone involved for the hard work, you are great !

Eli-Goldberg avatar Jun 03 '19 16:06 Eli-Goldberg

Hi @Eli-Goldberg ,

I will apply many more features on table. But nowadays i am very busy and i can reply help-request issues in my limited time. Thanks for your patience

mbrn avatar Jun 05 '19 10:06 mbrn

+1 Multi-sort is also important for us. Great work.

Michael-Roussel avatar Jun 05 '19 14:06 Michael-Roussel

@mbrn I needed this feature for a project and have things working great. Wanted to get your take as there are a few ways to go with this. Currently I added a new property called 'sortObject' to data manager which is passed onto table header through table as a prop. It is just a simple object { myFieldA: 'asc', myFieldB: 'desc', .... } . This really takes the place of orderBy and orderDirection, tracking all column sort state. Wasn't sure if you prefer I just replace orderBy and orderDirection with the new 'sortObject' prop as it would handle both single and multi-sort, but might be a breaking change, need to dig a bit further. Also, instead of a table option of 'multiSort' I've just used SHIFT key to track whether user wants current sort to be multi, if event.shiftKey is false it is single sort as usual, even if multi-sort had been active for numerous columns and user performs a new sort without holding SHIFT key then it reverts back to single sort. Any thoughts before I take a pull?

priemd avatar Jun 18 '19 01:06 priemd

+1 for multi sort on shift click only, I would also enable multi sort by default

rousselm4 avatar Jun 18 '19 02:06 rousselm4

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 Jun 15 '20 17:06 stale[bot]