Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2b4708b
docs(grid): document pdf export
ntacheva Jan 7, 2025
1f63941
chore(grid): updated export articles
ntacheva Jan 10, 2025
8bff13d
chore(Grid): update pdf export article and examples
ntacheva Jan 14, 2025
c4e5888
chore(grid): update export events
ntacheva Jan 14, 2025
0693df0
chore(grid): final updates
ntacheva Jan 14, 2025
8c2a1bb
Merge branch 'master' into document-pdf-export
ntacheva Jan 14, 2025
4dcc00d
chore(grid): final
ntacheva Jan 14, 2025
d124154
Update components/grid/export/csv.md
ntacheva Jan 27, 2025
891526f
Update components/grid/export/csv.md
ntacheva Jan 27, 2025
6666346
Update components/grid/export/events.md
ntacheva Jan 27, 2025
060ef54
Update components/grid/export/excel.md
ntacheva Jan 27, 2025
1f01e33
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
2b49f77
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
8aa616f
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
56bdcec
Update components/grid/export/excel.md
ntacheva Jan 27, 2025
0a25374
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
6f1eb00
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
822019c
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
3e964d0
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
710e906
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
803d997
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
32dbc68
Update components/grid/export/pdf.md
ntacheva Jan 27, 2025
68ca24e
Update components/grid/export/pdf.md
ntacheva Jan 29, 2025
1fd3daa
chore(Grid): address feedback
ntacheva Jan 29, 2025
6b0cc76
Merge branch 'master' into document-pdf-export
ntacheva Jan 29, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions components/grid/export/csv.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ To enable the grid CSV Export, add a [command button](slug://components/grid/col
</GridToolBarTemplate>
````

Optionally, you can also set the `GridCsvExport` tag settings under the `GridExport` tag to choose:
Optionally, you can also set the `GridCsvExport` tag settings under the `GridExport` tag to subscribe to the [Grid export events](slug:grid-export-events) that allow further customization of the exported columns/data or configure the CSV export options:

* `FileName` - the name of the file. The grid will add the `.csv` extension for you.
* `AllPages` - whether to export the current page only, or the entire data from the data source.
* Subscribe to [Grid export events](slug://grid-export-events) that allow further customizations of the exported columns or data.
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)

| Parameter | Type and Default&nbsp;Value | Description |
| --- | --- | --- |
| `FileName` | `string` | The name of the file. The grid will add the `.csv` extension for you. |
| `AllPages` | `bool` | Whether to export the current page only, or the entire data from the data source. |

>caption Export the Grid to CSV - Example

Expand Down Expand Up @@ -67,8 +70,9 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
</TelerikGrid>

@code {
List<SampleData> GridData { get; set; }
bool ExportAllPages { get; set; }
private List<SampleData> GridData { get; set; }

private bool ExportAllPages { get; set; }

protected override void OnInitialized()
{
Expand Down Expand Up @@ -99,8 +103,10 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp

You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:

* `SaveAsCsvFileAsync` - `ValueTask` - sends the exported CSV file to the browser for download
* `ExportToCsvAsync` - `Task<MemoryStream>` - returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance.
| Method | Type | Description |
| --- | --- | --- |
| `SaveAsCsvFileAsync` | `ValueTask` | Sends the exported CSV file to the browser for download. |
| `ExportToCsvAsync` | `Task<MemoryStream>` | Returns the exported data as a `MemoryStream`. The stream itself is finalized, so that the resource does not leak. To read and work with the stream, clone its available binary data to a new `MemoryStream` instance. |

>note The same methods are exposed for exporting an [Excel file](slug://grid-export-excel#programmatic-export).

Expand Down Expand Up @@ -146,16 +152,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol

private MemoryStream exportedCSVStream { get; set; }

private List<SampleData> GridData { get; set; }

private bool ExportAllPages { get; set; }

private async Task GetTheDataAsAStream()
{
MemoryStream finalizedStream = await GridRef.ExportToCsvAsync();

exportedCSVStream = new MemoryStream(finalizedStream.ToArray());
}

List<SampleData> GridData { get; set; }
bool ExportAllPages { get; set; }

protected override void OnInitialized()
{
GridData = Enumerable.Range(1, 100).Select(x => new SampleData
Expand Down
Loading