New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example code for uploading files #58
Comments
I came across this case too, let me try to help you out with this one. First we need to define the default actions (which you should have alrdy done to see the upload button): //enable some default actions you want in Chonky
const setFileActions : FileAction[] = [
ChonkyActions.UploadFiles
]; Then, define the handlers for //Define the handlers functions for the chonky actions.
const handleFileAction : FileActionHandler = useCallback(
(data) => {
if (data.id === ChonkyActions.OpenFiles.id) {
//do openfiles
}
//upload files
if(data.id === ChonkyActions.UploadFiles.id) {
console.log('Start Uploading files here....')
}
},
[setKeyPrefix]
); Not sure if this is a neater way of working on it, if there's feel free to comment on this. |
how to define action in js |
@cybertaxi thanks ! but can we make it drag and drop ? something like a drop zone for file upload ? |
@StarStuff15 you mean custom actions ? have you gone through https://chonky.io/docs/2.x/file-actions/custom-actions, it's pretty much explained |
Hey @satyajitghana, Chonky doesn't currently provide drop zone functionality, but it should work with any of the existing drop zone React libraries. |
For anyone looking for example implementation with drag-n-drop: https://github.com/ProjektTejas/tejas-web/blob/master/components/dataset.tsx |
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.1.2 to 4.1.3. - [Release notes](https://github.com/salesforce/tough-cookie/releases) - [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md) - [Commits](salesforce/tough-cookie@v4.1.2...v4.1.3) --- updated-dependencies: - dependency-name: tough-cookie dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
From the documentation https://chonky.io/docs/2.x/file-actions/built-in-actions i can see that
ChonkyActions.UploadFiles
just adds a button to the UI and we have to define the actions related to it, but i am finding it a little difficult on how to actually define that actions, can we have some starter/example code for handling the upload button ?The text was updated successfully, but these errors were encountered: