Skip to content
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

Callbacks when removing item on multiple files #325

Closed
aquaductape opened this issue Jun 1, 2022 · 2 comments
Closed

Callbacks when removing item on multiple files #325

aquaductape opened this issue Jun 1, 2022 · 2 comments
Labels

Comments

@aquaductape
Copy link

aquaductape commented Jun 1, 2022

Question

Does upload care have an API where it fires a callback when clicking delete button specific items? Also I couldn't find a callback for "Remove All" button as well.

Something like this?

<Widget
  onRemove={(files) => {
    const { id, index, name, data } = files[0]
    // ...
  }}
  >

Screen Shot 2022-06-01 at 12 20 46 PM

@aquaductape
Copy link
Author

aquaductape commented Jun 2, 2022

Seems like this is the way, However it only returns the index, is it possible to return both the item (like in fileColl.anyDoneList.add) and the index?

onDialogOpen={(dialog) => {
  dialog.fileColl.onRemove.add((_, item) => {
    console.log(item); // index
  });
}}

@aquaductape
Copy link
Author

onDialogOpen={(dialog) => {
  dialog.fileColl.onRemove.add(async (state, index) => {
    const file = await state.promise()
    console.log(file, index);
  });
}}

Answered in #326 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant