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
The `export` action of the Table widget has the next parameters that you can configure to your needs:
54
54
55
-
-`options` - an object with the export options; options differ depending on the format type:
55
+
-`options` - an object with the export options; options differ depending on the format type
56
+
-`result` - the result of the exported Excel or CSV data (usually Blob or file depending on the `download` option)
57
+
58
+
**Common options for both formats ("csv" "xlsx" ):**
59
+
60
+
-`format` (string) - (optional) the export format that can be "csv" or "xlsx"
61
+
-`fileName` (string) - (optional) a file name ("data" by default)
56
62
-`header` (boolean) - (optional) defines if a header should be exported (**true** by default)
57
63
-`footer` (boolean) - (optional) defines if a footer should be exported (**true** by default)
58
-
-`download` (boolean) - (optional) defines whether to download a file. **true** is set by default. if set to **false**, the file will not be downloaded, CSV data (Blob) will be available as `ev.result`
59
-
-`format` (string) - (optional) the export format that can be "csv" or "xlsx"
60
-
**Options for "xlsx" format:**
61
-
:::note
62
-
By default, for the "xlsx" format, date and number fields are exported as raw values with default format or the format defined via the [`fields`](/api/config/fields-property) property. But if a template is defined for a field (see the [`tableShape`](/api/config/tableshape-property) property), it exports the rendered value defined by that template. In case both the template and `format` are set, the template settings will override the format ones.
63
-
:::
64
-
- `fileName` (string) - (optional) a name of .xlsx file ("data" by default)
64
+
-`download` (boolean) - (optional) defines whether to download a file. **true** is set by default. If set to **false**, the file will not be downloaded, Excel or CSV data (Blob) will be available as `ev.result`
65
+
66
+
**Options specific for "xlsx" format:**
67
+
65
68
-`sheetName` (string) - a name of Excel sheet ( "data" by default)
66
-
- `styles` (boolean or object) - if set to **false**, grid will be exported without any styling; an object includes parameters for custom styles for cells in the header, body, and footer. Can be configured using a hash of style properties:
67
-
- header - style properties for header cells with the next properties:
69
+
-`styles` (boolean or object) - if set to **false**, grid will be exported without any styling; can be configured using a hash of style properties:
70
+
- header - an object with the next settings for header cells:
68
71
- `fontWeight` (string) - (optional) can be set to "bold" or if not set, the font will be normal
69
72
- `color` (string) - (optional) text color in header
70
73
- `background` (string) - (optional) background color for header
71
-
- `align` - (optional) text alignment that can be "left"|"right"|"center"; if not set, alignment set in Excel will be applied
74
+
- `align` - (optional) text alignment that can be "left"|"right"|"center". If not set, alignment set in Excel will be applied
72
75
- `borderBottom` (string) - (optional) the style of the bottom border
73
76
- `borderRight` (string) - (optional) the style of the right border (e.g., *borderRight: "0.5px solid #dfdfdf"* )
74
-
- lastHeaderCell - style properties for the last row of header cells; properties are the same as for *header*
75
-
- cell - style properties for body cells; properties are the same as for *header*
76
-
- firstFooterCell - style properties for the first row of footer cells; properties are the same as for *header*
77
-
- footer - style properties for footer cells; properties are the same as for *header*
78
-
- `cellTemplate` - a function to customize the export value of each cell. It takes the value, row, and column objects as parameters and returns the custom value to be exported;
79
-
- `headerCellTemplate` - a function that customizes the value of a header or footer cell during export. It is called with the text, header cell object, column object, and cell type ("header" or "footer"). This allows users to modify the exported header/footer values.
77
+
- lastHeaderCell - style properties for the last row of header cells. Properties are the same as for *header*
78
+
- cell - style properties for body cells.Properties are the same as for *header*
79
+
- firstFooterCell - style properties for the first row of footer cells. Properties are the same as for *header*
80
+
- footer - style properties for footer cells. Properties are the same as for *header*
81
+
-`cellTemplate` - a function to customize the export value of each cell. It takes the value, row, and column objects as parameters and returns the custom value to be exported
82
+
- `headerCellTemplate` - a function that customizes the value of a header or footer cell during export. It is called with the text, header cell object, column object, and cell type ("header" or "footer"). This allows users to modify the exported header/footer values
80
83
- `cellStyle` - a function that allows customizing the style and format of individual cells during export. It takes the value, row, and column objects as parameters and should return an object with style properties (e.g., alignment or format)
81
84
- `headerCellStyle` - similar to cellStyle, but specifically for the header and footer cells. This function takes the text, header cell object, column object, and type ("header" or "footer") and returns style properties
82
85
- `header` (boolean) - (optional) defines if a header should be exported (**true** by default)
83
86
- `footer` (boolean) - (optional) defines if a footer should be exported (**true** by default)
84
-
- `download` (boolean) - (optional) defines whether to download a file. **true** is set by default. if set to **false**, the file will not be downloaded, Excel data (Blob) will be available as `ev.result`
85
-
**Options for "csv" format:**
86
-
- `fileName` (string) - (optional) a file name ("data" by default)
87
+
- `download` (boolean) - (optional) defines whether to download a file. **true** is set by default. If set to **false**, the file will not be downloaded, Excel data (Blob) will be available as `ev.result`
88
+
89
+
:::note
90
+
By default, for the "xlsx" format, date and number fields are exported as raw values with default format or the format defined via the [`fields`](/api/config/fields-property) property. But if a template is defined for a field (see the [`tableShape`](/api/config/tableshape-property) property), it exports the rendered value defined by that template. In case both the template and `format` are set, the template settings will override the format ones.
91
+
:::
92
+
93
+
**Options specific for "csv" format:**
94
+
87
95
- `rows` (string) - (optional) rows delimiter, "\n" by default
88
96
- `cols` (string) - (optional) columns delimiter, "\t" by default
89
-
-`result` - the exported data result (usually Blob or file depending on the `download` option)
90
97
91
-
In the example below we get access to the Table instance and trigger the `export`action on the button click using the [`api.exec()`](/api/internal/exec-method) method.
98
+
In the example below we get access to the Table instance and trigger the `export`action using the [`api.exec()`](/api/internal/exec-method) method.
0 commit comments