You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/grid/export/csv.md
+19-12Lines changed: 19 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ published: True
8
8
position: 1
9
9
---
10
10
11
-
# CSV Export
11
+
# Grid CSV Export
12
12
13
13
You can export the grid to CSV with a click of a button. The current filter, sort, page, grouping and column order are applied to the `.csv` document.
14
14
@@ -32,11 +32,14 @@ To enable the grid CSV Export, add a [command button](slug://components/grid/col
32
32
</GridToolBarTemplate>
33
33
````
34
34
35
-
Optionally, you can also set the `GridCsvExport` tag settings under the `GridExport` tag to choose:
35
+
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:
36
36
37
-
*`FileName` - the name of the file. The grid will add the `.csv` extension for you.
38
-
*`AllPages` - whether to export the current page only, or the entire data from the data source.
39
-
* Subscribe to [Grid export events](slug://grid-export-events) that allow further customizations of the exported columns or data.
| Parameter | Type and Default Value | Description |
40
+
| --- | --- | --- |
41
+
|`FileName`|`string`| The name of the file. The grid will add the `.csv` extension for you. |
42
+
|`AllPages`|`bool`| Whether to export the current page only, or the entire data from the data source. |
40
43
41
44
>caption Export the Grid to CSV - Example
42
45
@@ -67,8 +70,9 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
67
70
</TelerikGrid>
68
71
69
72
@code {
70
-
List<SampleData> GridData { get; set; }
71
-
bool ExportAllPages { get; set; }
73
+
private List<SampleData> GridData { get; set; }
74
+
75
+
private bool ExportAllPages { get; set; }
72
76
73
77
protected override void OnInitialized()
74
78
{
@@ -99,8 +103,10 @@ Optionally, you can also set the `GridCsvExport` tag settings under the `GridExp
99
103
100
104
You can programmatically invoke the export feature of the Grid, by using the following methods exposed on the `@ref` of the Grid:
101
105
102
-
*`SaveAsCsvFileAsync` - `ValueTask` - sends the exported CSV file to the browser for download
103
-
*`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.
106
+
| Method | Type | Description |
107
+
| --- | --- | --- |
108
+
|`SaveAsCsvFileAsync`|`ValueTask`| Sends the exported CSV file to the browser for download. |
109
+
|`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. |
104
110
105
111
>note The same methods are exposed for exporting an [Excel file](slug://grid-export-excel#programmatic-export).
106
112
@@ -146,16 +152,17 @@ You can programmatically invoke the export feature of the Grid, by using the fol
0 commit comments