mui-datatables
mui-datatables copied to clipboard
How I can cancel download file csv
How I can cancel download
onDownload: (buildHead, buildBody, columns, data) => {
// cancel here
},
How can I cancel the file download, to use another file format
I think you're looking for these options
which allow you to change the file name. I'm not sure cancelling the download is what you want, as that will stop it from occurring entirely.
return false
Hello team, this is a portion of my code (which is weird but works with excel...)
handleOnDownload(buildHead, buildBody, columns, data) {
let csvContent = buildHead(columns) + buildBody(data);
var a = document.createElement('a');
var textFileAsBlob = new Blob(["\ufeff",csvContent], {
type: 'text/csv;charset=UTF-8',
encoding: "UTF-8"
});
a.href = window.URL.createObjectURL(textFileAsBlob);
a.download = 'exportCims.csv';
a.click();
return false;
}
my option on my grid is
downloadOptions: {filterOptions : {useDisplayedRowsOnly : true}},
onDownload: (buildHead, buildBody, columns, data) => {this.handleOnDownload(buildHead, buildBody, columns, data)},
the return false does not work... ? (mui-datatable 3.7.3)
Same problem with return false here:
_onDownload = () => {
console.log('_onDownload');
return false;
}
The file is still downloaded. Version 3.7.6
I can confirm this is still an issue. (mui-datatables 3.7.7)