CSV and PDF Export
Hello
I am exporting data from the grid. My grid tells me that there are 195 rows on the grid.
If I look at the properties of the Grid I can see that there is a TotalCount of 195 (I have some filters on). I am using
the following code to export a custom datasource:
var lstExport = new List<TimeModel>();
foreach (var item in this.TimeGrid.CurrentViewData)
{
var exportItem = (TimeModel)item;
lstExport.Add(exportItem);
}
ExcelExportProperties ExcelProperties = new ExcelExportProperties();
ExcelProperties.DataSource = lstExport;
The problem is that when I do this only 100 of the 195 are exported. My page size is 100, so I presume this is related. How do I get all 195 records to export using a custom datasource?
Thanks
SIGN IN To post a reply.
3 Replies
RN
Rahul Narayanasamy
Syncfusion Team
October 19, 2020 10:47 AM UTC
Hi Ditchford,
Greetings from Syncfusion.
Query: CSV and PDF Export - How do I get all 195 records to export using a custom datasource?
We have validated your query and you want to define the DataSource dynamically before exporting. You can achieve your requirement by using DataSource property of PdfExportProperties. Find the below code snippets for your reference.
|
<SfButton OnClick="PdfExport" Content="Pdf Export"></SfButton>
<SfGrid @ref="DefaultGrid" DataSource="@Orders" AllowPdfExport="true" AllowPaging="true">
<GridColumns>
. ..
</GridColumns>
</SfGrid>
@code{
private SfGrid<Order> DefaultGrid;
. . .
public async Task PdfExport()
{
PdfExportProperties PdfProperties = new PdfExportProperties();
PdfProperties.DataSource = Orders; //assign custom datasource here
await this.DefaultGrid.PdfExport(PdfProperties); //perform export with PdfProperties
}
} |
Reference:
Please let us know if you have any concerns.
Regards,
Rahul
DI
Ditchford
October 23, 2020 11:52 PM UTC
Hello
Thanks, but that will not give me the correct number of records if the user has filtered or searched.
Is there a way to do that?
RN
Rahul Narayanasamy
Syncfusion Team
October 27, 2020 02:02 PM UTC
Hi Ditchford,
We have validated the your query and we have considered your query as an improvement feature and logged the improvement report for the same. Thank you for taking the time to request this improvement “need to provide support for exporting custom data without applying the dataoperations” and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the improvement in any of our upcoming release.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Until then we appreciate your patience.
Regards,
Rahul
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DI Ditchford
- Oct 16, 2020 07:06 AM UTC
- Oct 27, 2020 02:02 PM UTC