-
Notifications
You must be signed in to change notification settings - Fork 932
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
Question regarding the use of onRowsDelete. #853
Comments
The way If you want to delete rows on the UI as a result of a successful response from an asynchronous request, then you would need to supply your own delete button and function via There is a PR up now which should help devs to integrate asynchronous requests with the |
Okay Gabriel, I keep track of the onRowsDelete function progress. |
If you're not concerned with making the request first and making the table deletions dependent on that, then the code you have should work as is. So that is correct, you should bear in mind that even if your request is unsuccessful, the rows will still show as deleted from the table, so you will have to re-render the table to show the correct data in that case. The other option is to create your own delete function with |
Hi grabriel, so I must create my own delete button and incorporate it into the customToolbarSelect option? |
Correct, for now, the only solution is to add your own custom select toolbar as in the
|
Thank you very much Gabriel! |
Well, since you asked it here, I'll answer it here! There have been a number of issues opened about showing/hiding the bar including some PRs. My trouble is that out of all of them, I don't think I've ever heard a good answer to the UX question about what exactly is supposed to happen once it's removed, since that's the only way users currently have of acting on their selections. You can prevent any selections from taking place at all with the options, but if you allow selections and remove the bar, I don't see how users will make any use of their selected fields. I'm open to hearing what the user story here would be. |
Well, the buttons of my application I am showing them below the AppBreadcrumbs component. If I'm not going to use any button in the table, it doesn't make much sense to show the empty bar when checking a checkbox. I mean the bar that is displayed showing the delete button. |
I'll take that into consideration. You can watch the other issues on this or the PR up for review to keep up-to-date on this issue. |
Ok, thanks Gabriel !! Excuse my bothering. |
Hi, I have a question regarding the use of onRowsDelete.
I want to use the following function to remove items from the table, but I don't know if I am using it correctly combined with the option onRowsDelete Thanks in advance.
handleDeleteUser = (idToDelete) => {
axios.delete(
https://jsonplaceholder.typicode.com/users/${idToDelete}
).then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
};
render() {
const options = {
onRowsDelete: (rowsDeleted) => {
const idsToDelete = rowsDeleted.data.map(item => item.dataIndex)
idsToDelete.map(idToDelete => this.handleDeleteUser(idToDelete))
}
};
The text was updated successfully, but these errors were encountered: