components icon indicating copy to clipboard operation
components copied to clipboard

[Table] Add ability to expand rows on interaction

Open vibingopal opened this issue 9 years ago • 80 comments

Bug, feature request, or proposal:

Hi Team,

Is it possible to extend the table row on click of the record. For example, a table with more records exist and when the user clicked on particular row, the row should expand and show card with the row information in detail as shown below.. image

Material : 2.0.0-beta.8 Angular : 4.0.0

vibingopal avatar Jul 27 '17 19:07 vibingopal

See #5936

Please keep GitHub issues for bug reports / feature requests. Better avenues for troubleshooting / questions are stack overflow, gitter, mailing list, etc.

donroyco avatar Jul 27 '17 20:07 donroyco

Hi Andrew,

Thank you for adding this as feature. May i know when the feature will be available ?

vibingopal avatar Jul 28 '17 14:07 vibingopal

This will be a lower priority feature that we'll need to incorporate after we've worked on features such as virtual repeat and sticky rows/columns to make sure that it's able to work alongside these higher priority features.

andrewseguin avatar Jul 28 '17 17:07 andrewseguin

99% of applications need this feature so I cannot understand why this is a lower priority :(

pantonis avatar Jul 28 '17 17:07 pantonis

Virtual repeat and sticky rows/columns are a much higher priority than expanding rows and should be implemented first before bringing in this feature. It's likely that you will be able to create some kind of expanding row UX when rows can be conditionally displayed using the when predicate. #5887

andrewseguin avatar Jul 28 '17 17:07 andrewseguin

Ok since I am planning a new project and I need to know dates can you give an approximation of when this is gonna be implemented please?

Hope you understand. Thanks

pantonis avatar Jul 28 '17 18:07 pantonis

@irowbin I know it takes time and that the guys are doing their best. And you can see that from the great result they achieved so far. When you have to plan a project though you need some estimates in order to make your plan and succeed. Since this is the most critical control we are going to use I need to have some estimates.

pantonis avatar Jul 28 '17 18:07 pantonis

Instead of expanding rows if we can click on a button in the row and go to an item details view, modal or form, that would be good enough for now.

I just started trying to figure this out a few minutes ago and found this active conversation with a Google search. I'm not sure if this is possible, my skills are "limited', but something like this. I have a click event in a button in a row. I need to grab the member.$key, which does display in the second column below with my data, but I haven't figured out how to get the $key (Firebase key) in the click param 'member' yet. Using member.$key and row.$key as a param doesn't work.

  <ng-container cdkColumnDef="edit">
    <md-header-cell *cdkHeaderCellDef> Edit </md-header-cell>
    <md-cell *cdkCellDef="let row"> <button class="badge"
            (click)="goToDetailPage(member)">Edit</button> </md-cell>
  </ng-container>

  <!-- key Column -->
  <ng-container cdkColumnDef="key">
    <md-header-cell *cdkHeaderCellDef> Key </md-header-cell>
    <md-cell *cdkCellDef="let row"> {{row.$key}} </md-cell> // This displays the db key.
  </ng-container>

jmpreston avatar Jul 28 '17 18:07 jmpreston

Thanks for the suggestion Jim.. But here data is represented in the form of rows. So on click of particular row data the view should open. For that there should be some link provided between row data and row detail which is not supported in the current package at this moment.

vibingopal avatar Jul 28 '17 19:07 vibingopal

KendoUI widgets are implemented in angular (no jQuery wrapper)..

KendoUI angular datagrid master/details

I am also looking at alternative to material datagrid since it is not polished and ready for real projects (no choice). My project can't wait for material 2 implementations of mater/detail and neither team will venture into developing widgets (no resource to do it)

ghost avatar Jul 28 '17 20:07 ghost

@vibingopal It seems that the row is an object and that there should be some JS way of capturing it and sending the whole data object back to the component code to be parsed there. Is there a row identifier that could be captured somehow. Master/detail is a biggee and it would be nice to figure out a hack until a more elegant solution is provided.

jmpreston avatar Jul 28 '17 20:07 jmpreston

I found another cool open-source UI Platform from Teradata that is built on Angular & Angular Material (Design). It is pretty much material 2 next version. They're not implementing master/detail because material 2 has not included in road-map.

An open-source UI Platform from Teradata

ghost avatar Jul 29 '17 09:07 ghost

For the AM2 Data Table as master - detail I posted my code here: https://stackoverflow.com/questions/45402690/how-to-setup-angular-material-2-data-table-setup-as-master-detail

Easy solution. It isn't the drop-down solution that some posters above have requested.

jmpreston avatar Jul 29 '17 22:07 jmpreston

I've added expand/collapse row by following an example from here https://plnkr.co/edit/ZL6OnWwVmOCPYetp96XX?p=preview However I am still unable to freeze columns from left/right while horizontal scroll.

For instance here is my snapshot.

capture

irowbin avatar Jul 31 '17 06:07 irowbin

@svstartuplab Since the expandable rows feature is on the backburner I had to implement a modal on row click that does just that, I pass the user's id to my modal and have an API call to get the detailed infos show up in the modal.

Lakston avatar Jul 31 '17 06:07 Lakston

@Lakston @irowbin Please add your solutions to my Stack Overflow post at https://stackoverflow.com/questions/45402690/how-to-setup-angular-material-2-data-table-setup-as-master-detail.

Nice to collect them on one place that everyone can find easily.

jmpreston avatar Jul 31 '17 14:07 jmpreston

@lakston Could you please let me know that you implemented the feature of material2 or you followed @svstartuplab example to implement it.

Thank you

vibingopal avatar Jul 31 '17 14:07 vibingopal

@svstartuplab it is pretty easy followed by that plnkr link above. 😃

irowbin avatar Jul 31 '17 15:07 irowbin

All, please be aware of @jelbourn's note https://github.com/angular/material2/issues/5936#issuecomment-318513544 about that example plunker (https://github.com/angular/material2/issues/6095#issuecomment-318976369) before you incorporate it.

It works, but will probably be incompatible with future enhancements.

willshowell avatar Jul 31 '17 16:07 willshowell

@Irowbin, From your example could you please let me know on row click how can you add a card with data. I am not able to add any card on row click.

vibingopal avatar Aug 01 '17 02:08 vibingopal