[Table] Add example with dynamic data (add/remove/edit rows)
Bug, feature request, or proposal:
cdk table API docs need instructions and/or an example of updating the dataSource in the table connecting the table to a data source
What is the expected behavior?
seeing implementation instructions and/or an example of how to send the updated dataSource to the table so that the connect function is called
What is the current behavior?
The docs only cover rendering data on initial load of the component, but if a service updates the data, there isn't a documented way to update the data-table
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: https://goo.gl/DlHd6U
What is the use-case or motivation for changing an existing behavior?
the md-table API doc hints at an approach but also lacks clarity
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
angular 4 material 2 typescript 2.4 windows
Is there anything else we should know?
@armansujoyan
I tried this:
self.dataSource.data.push(m as any);
self.dataSource._updateChangeSubscription();
unfortunately didn't work...my table renders new rows, but the rows are empty - the cells don't get rendered. This is all very unfortunate. What kind of library is this? I can't add rows to a table? FML.
@ORESoftware For recording used free software ScreenToGif, and after that uploaded .gif to Imgur.
@andrewseguin I want to create mat table with dynamic columns and I have array of object in which each object has fields which i want to show it vertically.

In above image I have object where all column fields are in one object and I want to show columns of every object in array. If anyone could provide some guidance i would truly appreciate it.
@marinantonio how to post it permanently you are just pushing it temporary how to post it using post method in angular2
@chethan1095 What do you mean? You push post method from DataService.ts and then depending on result (successful or not) you push front-end update to a mat-table.
I need some help, in rendering the value in the data table when the datasource has multiple json array. below is the service json response { "_index": "com_reprocess", "_type": "reprocessor", "_id": "com-payment-intake-62fc632e-5ac3-40d8-a35a-0yment-intake-paypalclosure-q2", "_score": 1, "_source": { "applicationName": "com-payment-intake-paypalclosure-q2", "topic": "COMPayment-PaypalClosure-q2", "retryInterval": 0, "maxRetryCount": 3, "isAutoRetryable": "false", "cassandraTTL": 3000000, "reprocessId": "aafde69c-7379-4bca-ac6e-c2e30bd4be11", "sequenceNo": "1521827002607", "key": "com-payment-intake-62fc632e-5ac3-40d8-a35a-0b2cbd9facf1_WA11121773", "errorCode": "-104", "createTimeStamp": "2018-03-23T17:43:22", "currentRetryCount": 0, "createProgId": "com-payment-intake-paypalclosure-q2_CONSUMER1_fcf59940-37c3-4478-becc-3798e0e0c4a2", "state": "initial", "groupforSameKey": false, "nextRetryTime": "2018-03-23T17:44:22", "clientHeaders": [ {"key": "com-acf1_WA11121773", "value" :"FAILED"} ], "hostIP": "10.255.220.35", "hostName": "dbb6f7b4-4909-479c-79c3-1e95", "isESRecordLocked": false, "modifyTimeStamp": "2018-03-23T17:43:22" } },
where i'm trying to iterate the response and bind them to material datatable. It is all good but i can't access the attributes inside the clientHeaders array.
here is my material table html statements and it is not returning any value.
<ng-container matColumnDef="value" style="column-width:500px">
<mat-header-cell *matHeaderCellDef mat-sort-header [ngClass]="'value'"> fail_rsn </mat-header-cell>
<mat-cell *matCellDef="let element" [ngClass]="'value'"> {{element._source.clientHeaders.key}} </mat-cell>
</ng-container> Can any one help on this ? stuck with 2 days on this
@andrewseguin Great job man! Can you please share a link to the repository for the updates you made that includes adding/removing/editing rows and if possible, editing individual cells. Thank you.
Are the examples still coming to the documentation?
Vielen Dank für Ihre Nachricht.
Ich bin vom 25. Juni bis 1. Juli im Urlaub. Ab Montag, dem 2. Juli bin ich wieder gerne für Sie erreichbar.
Ihre E-Mail wird an [email protected] weitergeleitet. In dringenden Fällen wenden Sie sich bitte an Sebastian Homeier (E-Mail: [email protected], Tel.: +49 (0) 941 462 971 30).
Danke für Ihr Verständnis!
Viele Grüße Johannes Homeier
@andrewseguin This is really important! Is an example coming out soon?
Hello, I have problem with my code. Any ideas? Thank you ! https://stackoverflow.com/questions/51478019/binding-the-data-into-mat-table-angular
@irossimoline I liked your solution, Can I use it with reactive forms and formArray?
I created a library to solve that (seamless http paginating/sorting/filtering with MatTable), the docs are not ready yet, but you have a complete functional usage example in src/app: https://github.com/avatsaev/ngx-mat-table-extensions
If any adventurous folks want to try it out and let me know if I need to add anything else before official release?
online demo is here: https://stackblitz.com/github/avatsaev/ngx-mat-table-extensions
this.dataSource.data = [...this.dataSource.data, {}];
this.dataSource.data = [...this.dataSource.data, {}];
Is there any update or new info available on this issue?
I have created below the table and I have a pretty much same CRUD operation requirement on this table. I am also using mat-dialog for pop up. Parent-child(main HTML - popup HTML) communication between component is working but at the same time want to update view - backend data in real time At this stage I am using locally created json mock data. Below is the image of the table
Any updates on this issue?
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.
