-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(sort): allowing sorting by multiple columns #13538
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
Conversation
Extended the Sort interface for active to allow string array and SortDirection to allow dictionary object. Adding matMultiColumn property to MatSort that will allow multi column sorting. Updating MatTableDataSource to handle multi column sorting. Adding a counter for sort-header that shows sorting precedence. Because of extended interface of MatSort, properties active and direction now need to be cast to string for existing usages. Fixes angular#7226.
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
Hi @relair! This PR has merge conflicts due to recent upstream merges. |
Merging changes from material
…ti-column-sorting # Conflicts: # src/demo-app/table/custom-table/custom-table.html # src/demo-app/table/custom-table/custom-table.ts # src/demo-app/table/data-input-table/data-input-table.ts # src/demo-app/table/element-data.ts
@jelbourn @andrewseguin Have you got the time to review this PR, I saw the the issue is labeled P3, hence it's an important PR. I think that the community is in a real need of this feature. |
<--- Member of the community in real need of this feature... Please with cherries on top? |
I put off reviewing this while we were working on getting v7 out, and now I'm currently doing a bit of travel. I should be able to take a look sometime next week. |
@relair we appreciate time time spent working on this. I took an initial look and have some high-level comments:
|
@jelbourn Thank you for taking a look:
|
For now I will make MatSortHeader work for both MatSort and MatMultiSort as I think it would be awkward for the user to need to define different directive name for sort headers when using MatMultiSort although I could change it too. |
Creating separate directive for MatMultiSort. Moving common code to MatSortBase. Creating SortHeaderStrategy to keep the logic for simple and multi column sort consolidated. Making setting getSortCounter optional.
Merging changes from material
…ti-column-sorting # Conflicts: # src/lib/sort/sort-header.ts
I have finished the refactoring, I did create MatMultiSort that shares some code with MatSort trough base class. I also refactored MatSortHeader so it is using strategy pattern to chose the logic which needs to use (no more if statements everywhere), I have also fixed aria description for MatSortHeader so whenever it is sorted by several columns multiple headers would just have description that says it is sorted ascending or descending. |
Merging master
…ti-column-sorting
Hi! Is there any plans on merging this branch any time soon? I've testing the implementation and it's been working great for me. Good job and thanks @relair |
Pleeeeeeeaaase! |
Been watching this for a while it will be sad to see if this PR becomes outdated and kicked to the side |
Here's how I got it running. Many thanks to @relair for this great work!
|
Hey @relair, thanks for submitting this pull request. I apologize that it has taken so long for us to dive into it and get it merged into the library. You did a great job with this and I think we can work with this to get the functionality in. I looked over the code and I recognized that we have an existing issue, which is likely what you found as well. The I'm thinking we can have the Another bit of contention the UX that I think we can solve if we allow the user to provide a custom template to be used to the right of the arrow. I'm going to try and come up with a PR that inverts that state management a bit and we can go from there. Once again I'm sorry that we drop the ball on reviewing this sooner. We got a bit caught up in some other tasks like helping the core team land Ivy, but I think its important that we make sure we focus on contributors that want to help us and our users. |
I'm going to split this pull request up into three stages.
|
Hey @andrewseguin, thank you for looking into getting this feature done. I did notice that I did that pull request at a bit unfortunate time as the new angular version was just being released, so I was waiting patiently until someone will find some time. |
Fortunately it looks like we'll avoid any breaking changes (except to the constructor of Thanks again for starting us off on this feature, we are now talking about moving a lot of the core logic of the sort manager to the CDK and make it easier for users to extend and swap things around. Feel free to take a look at the first step on this initial PR: #15171 Next steps after that will be to allow a custom template to be provided to follow the sort arrow (for the multi sort counter), and then a pull request to include your multi-sort using the new refactored setup |
Hi.. Could you please tell me when this feature will be merged to master? Thanks in advance |
@raghufsmk I probably will not have the time to personally message you that this is ready, but you are welcome to keep an eye on issue to see when it is closed, which means it is merged in master |
How does it take months to get a review done? We are also waiting for this feature. |
Hmm, why is CLA complaining again? |
@andrewseguin Hi Andew, what is the progress on pulling this request? Do I need to do something more with that pull request that could help? |
@relair Hey sorry for the delay, we've had to shift a lot of our work into Ivy-related issues. Right now we're waiting on getting this PR in, which is based off your work and lets us decouple the |
There is no activity in the PR that is apparently a blocker for this one? Except some emoticon labelling... |
@Noppey This is at a lower priority than getting Ivy out the door, but we still very much value this use case. We're currently considering a bigger change where we bring some of this logic into the CDK, which add a bit more of a delay since we need to make sure we design it right. |
there's no good reason for this to be stalled out. |
Can we get some examples on how to use the 'matSortActive' and 'matSortDirection' inputs on the MatMultiSort directive please. I'm trying to define a default sort in a template and I can't seem to define the structure correctly and get errors from .isSortDirectionValid(). |
Hey guys, Great work with IVY. Now that it is released, can we get an ETA on this ? Thanks. |
This PR helped to kick off design work towards this feature. I'll close it now in favor of those new PRs to come. It's on our backlog but not a priority unfortunately. Thanks again for the work on this, it really helped us identify how we can decouple the sort and header so that they can be reusable. We really value the work and I'm sorry that we could not put more resources into it right now |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Extended the Sort interface for active to allow string array and SortDirection to allow dictionary object. Adding matMultiColumn property to MatSort that will allow multi column sorting. Updating MatTableDataSource to handle multi column sorting. Adding a counter for sort-header that shows sorting precedence.
Breaking change: Because of extended interface of MatSort, properties active and direction now need to be cast to string for existing usages. Fixes #7226.