- Plugin Hook
- Optional
useExportData is the hook that helps in downloading table data.
- You need to provide
fileBlobfor download, so as to make it flexible to download data in any format.
The following options are supported via the main options object passed to useTable(options)
disableExport: Bool- Disables exporting of data at table level.
getExportFileBlob: Function({ columns, data, fileType, fileName }) => FileBlob | false- Required
- This function is used to return data as
FileBlobwhich will be downloaded - In Above definition
columnsis downloadable columns based on select configuration ofAllData orCurrentview - Return
falseis downloading of file is already taken care of at consumer level
getExportFileName: Function({ fileType, all }) => string- Optional
- This function is used to overwrite exported file name.
- Default fileName is
all-data.<fileType>anddata.<fileType>forAllData andCurrentview repectively
The following options are supported on any Column object passed to the columns options in useTable()
-
disableExport: Bool- Optional
- Defaults to
false - If set to
true, this column will not be exported with data
-
getColumnExportValue: Function(column) => string- Optional
- This function is used to overwrite exported value of Header for this column
-
getCellExportValue: Function(row, column) => string- Optional
- This function is used to overwrite exported value for this cell
The following values are provided to the table instance:
exportData: Function(fileType: string, all: boolean)- This function is used to initiate downloading of data
- Parameter
alldefined whether you want to download full data or current view only.Current viewconsiders sorted, filtered data that is currently visible to user.
The following properties are available on every Column object returned by the table instance.
-
canExport: Bool- Denotes whether a column is exportable or not depending on if it has a valid accessor/data model or is manually disabled via an option.