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

Form Field data in mat-table is not present in Exported document #94

Open
abhip5369 opened this issue Dec 5, 2020 · 8 comments
Open
Labels
exporter feature request New feature or request

Comments

@abhip5369
Copy link

abhip5369 commented Dec 5, 2020

Hi,
I am having some form fields in my mat-data-table, which user can fill in runtime, however on export the fields are coming as blank.
Below is the stackbliz of the same :

https://stackblitz.com/edit/mte-demo-dwz9uo?file=src/app/app.component.html

Also is there a way to ignore any particular row in mat-data-table while exporting ?
I have a "No Data present" row in my table which gets conditionally displayed in case there in no data from backend, but this row comes in exported doc irrespective of data is present or not.

@HalitTalha HalitTalha added exporter feature request New feature or request labels Dec 6, 2020
@ayandebbarman
Copy link

Commenting as facing the same issue

@ccosmincc
Copy link
Contributor

ccosmincc commented Dec 19, 2020

@abhip5369 "Also is there a way to ignore any particular row in mat-data-table while exporting ?" - have you tried using MatTableExporterDirective's toggleRow method to select the rows which you want to be exported?

@abhip5369
Copy link
Author

abhip5369 commented Dec 20, 2020

@ccosmincc Can you provide a stackbliz example for using toggleRow . I had tried it , but it throws error like toggleRow (1,2) is not a function.

Also toggleRow(index: number) is Called to mark the row for selection export, if the requirement is to export only selected rows. Having no rows selected means export everything. So if I want to exclude only 1 row dynamically how can I do that.

https://stackblitz.com/edit/mte-demo-1thybv?file=src/app/app.component.html

@ccosmincc
Copy link
Contributor

ccosmincc commented Dec 20, 2020

@abhip5369 toggleRow method was introduced in one of the latest versions of the library. Your stackblitz uses
"cdk-table-exporter": "1.2.1",
"mat-table-exporter": "1.2.1"
First update those two packages (in package.json file) to version 9.0.2 to have toggleRow method available.
Then, in app.component.html replace the export button with the following line to only export the first row, for example:
<button mat-button (click)="exporter.toggleRow(0); exporter.exportTable('csv')">Export</button>
To obtain the desired behavior, just use the exporter.toggleRow(index) (index is 0-based) for all rows, except for the one that you want to exclude, and then call exporter.exportTable.
Here is a demo with row selection via checkbox column: https://stackblitz.com/edit/mte-demo-qtadtp?file=src/app/app.component.ts

@abhip5369
Copy link
Author

@abhip5369 toggleRow method was introduced in one of the latest versions of the library. Your stackblitz uses
"cdk-table-exporter": "1.2.1",
"mat-table-exporter": "1.2.1"
First update those two packages (in package.json file) to version 9.0.2 to have toggleRow method available.
Then, in app.component.html replace the export button with the following line to only export the first row, for example:
<button mat-button (click)="exporter.toggleRow(0); exporter.exportTable('csv')">Export</button>
To obtain the desired behavior, just use the exporter.toggleRow(index) (index is 0-based) for all rows, except for the one that you want to exclude, and then call exporter.exportTable.
Here is a demo with row selection via checkbox column: https://stackblitz.com/edit/mte-demo-qtadtp?file=src/app/app.component.ts

I am using Angular 8 & on official doc , its written :
NOTE: For the previous major versions of Angular (Angular 8 and older versions) install version 1.2.5.

Is it possible to back propagate this feature ?

@HalitTalha
Copy link
Owner

Hi @abhip5369 unfortunatelly we are not planning to support prior major versions with the latest features..

@abhip5369
Copy link
Author

Hi @abhip5369 unfortunatelly we are not planning to support prior major versions with the latest features..

Thanks @HalitTalha . Could we expect the above requested feature of having form fields data in the exported sheets in coming releases ?

@HalitTalha
Copy link
Owner

@abhip5369, yes sure it will. However I can not give an exact time for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants