Skip to content
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

Grouping feature in Data Table/Grid #10660

Closed
ameya opened this issue Apr 2, 2018 · 20 comments
Closed

Grouping feature in Data Table/Grid #10660

ameya opened this issue Apr 2, 2018 · 20 comments

Comments

@ameya
Copy link

ameya commented Apr 2, 2018

####proposal: Grouping feature in the table

What is the expected behaviour?

We should be able to group contents of a column by row.
Following example shows grid group by the company.
http://plnkr.co/edit/myDUiu7cdrGopQgn7t2p?p=preview

What is the current behaviour?

Not present.

What is the use-case or motivation for changing an existing behaviour?

The user wants a drill down feature on the table, where they see aggregated/group value and they can choose to drill down or not.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

5.2.4

@andrewseguin
Copy link
Contributor

It sounds like you may benefit more from the <mat-tree> instead of the table. It'll be out soon but you can try it out using the latest cdk/material: https://github.com/angular/material2/blob/master/src/lib/tree/tree.md

@ameya
Copy link
Author

ameya commented Apr 2, 2018

So does this tree goes with table? Because what I am looking for is not tree but a grid with groping feature. There may be many like me looking for this feature in data table. Even extjs has table grouping

@andrewseguin
Copy link
Contributor

Maybe I don't understand your request. You seem to be describing the functionality of a tree, which provides grouping and drilldown. Can you describe why the tree isn't a good fit?

@ameya
Copy link
Author

ameya commented Apr 3, 2018

Can you look at this link http://plnkr.co/edit/myDUiu7cdrGopQgn7t2p?p=preview this is a grouped paginated grid/table?

@andrewseguin
Copy link
Contributor

I did take a look but it looks very much like what we have going in the tree. I'm curious what features you find are missing that are not address by the tree.

@ameya
Copy link
Author

ameya commented Apr 3, 2018

A tree is a one dimensional or just has parent and child arrangement. But tree is 2 dimensional has multiple column and rows. For example in the above example. In the 2 dimessional display I would like to group the data by city. Say for example a table displaying employee details. So he has his sal, gender, org unit, designation. Here i would like to see all employee grouped by org unit in the grid. I may show addional details in summary below the group like counts of each designation in that organization unit. This is a very common demand in an enterprise application.

@ameya
Copy link
Author

ameya commented Apr 3, 2018

So if the requirements I am asking has tree structure can I use tree in grid to get the desired results I am asking in the link?

@chriscurnow
Copy link

I have to agree with @ameya. A data table has columns. A tree does not. So to use @ameya's example we might have the columns:

  • Name
  • Gender
  • Salary
  • Org Unit

When the table is totally collapsed we would have just a list of Org Units – exactly as per a tree except that it will still have column headings across the top.
However, when we expand one of the Org Units, we will have a list of employees with the columns as above.

I could see we could potentially achieve something like this if we had a table inside each tree node, but as I envisage it just now, that seems like a lot of work. Perhaps not. I will try it out.

I can see you don't want to add unnecessary features to the table component. You want it to be unopinionated. However, we still need a way to collapse rows.

@chriscurnow
Copy link

@StephenWTurner
Copy link

I wanted this feature too so I worked on some code here: stackblitz. This has an array of columns to group by and recursively inserts group rows into the data that are displayed differently using the matRowDef's where clause.

The tree view doesn't seem well suited for a tabular display, it seems it would be difficult to display the column headers once and still have columns efficiently fit the width of the data.

I envisage that the grouping could be inserted in the material2/src/lib/table/table-data-source.ts so the groups are added after the data is paginated but before it is rendered in _updateChangeSubscription(). Placed here the page would still show the same number of rows regardless of how many group rows were added and the total row count would not change. The grouping would be independent of filtering, pagination and sorting, although having the sort match the grouping may be a preferable experience.

@andrewseguin It's beyond my current skills to integrate this with the library and create a pull request. Hopefully, this issue can be re-opened and someone can help.

@DmitryEfimenko
Copy link

This issue should not have been closed. Trees don't solve the requirements of data being grouped in the table.
Please reopen

@chriscurnow
Copy link

chriscurnow commented Mar 15, 2019

I wanted this feature too so I worked on some code here: stackblitz. This has an array of columns to group by and recursively inserts group rows into the data that are displayed differently using the matRowDef's where clause.

This is pretty much what we want.

@ameya
Copy link
Author

ameya commented Mar 15, 2019 via email

@lujian98
Copy link

lujian98 commented Apr 7, 2019

Thank you @StephenWTurner
Follow your code and made a few changes to allow change header row grouping.
Demo is here: https://stackblitz.com/edit/angular-material-table-row-grouping

@HirenParekh
Copy link

I don't understand why this issue is closed. Somebody, please open it.

@altsanz
Copy link

altsanz commented Jun 7, 2019

Needing this feature also.

@maxalegre
Copy link

I don't understand why this issue is closed. Somebody, please open it.

+1

@daddyschmack
Copy link

This is a necessary feature...

@sgavathe
Copy link

sgavathe commented Aug 15, 2019

https://github.com/olifolkerd/tabulator
Worst case integrate this one if you can't have one.

It's also accessible, if you have to implement that.
http://tabulator.info/docs/4.3/accessibility

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests