Skip to content

Commit

Permalink
chore: only accept CSV files
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding authored Jan 10, 2025
1 parent 53d8037 commit 5ed26ef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/examples/slickgrid/Example43.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ export default function Example43() {
}

function handleFileImport(event: any) {
const file = event.target.files[0];
if (file) {
const file: File = event.target.files[0];
if (file.name.endsWith('.csv')) {
const reader = new FileReader();
reader.onload = (e: any) => {
const content = e.target.result;
dynamicallyCreateGrid(content);
};
reader.readAsText(file);
} else {
alert('File must be a CSV file');
}
}

Expand Down

0 comments on commit 5ed26ef

Please sign in to comment.