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

Child row of a child row does not show "Are you sure you want to delete this row?" #830

Closed
KippWade opened this issue Jan 30, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@KippWade
Copy link
Contributor

Describe the bug
When using the parent/child option, a child of a child with children will not show the deletion text "Are you sure you want to delete this row?"

To Reproduce
https://codesandbox.io/p/sandbox/material-table-core-parent-child-forked-8rk59g

  1. Expand first child level by clicking on the row (codesandbox example, the row is blue)
  2. Expand the second child level by clicking on the embedded row (codesandbox example, the row is green)
  3. On the second level (green row), click the delete trashcan icon
  4. The text "Are you sure you want to delete this row?" does not appear, the row is blank.

Expected behavior
Expected to see the default "Are you sure you want to delete this row?" text.

Screenshots
image

Desktop:

  • OS: Windows 11
  • Browser Chrome
  • Version 120.0.6099.227 (Official Build) (64-bit)
@KippWade KippWade added the bug Something isn't working label Jan 30, 2024
@Domino987
Copy link
Contributor

I'll take a look

@KippWade
Copy link
Contributor Author

With new CodeSandbox rules, I'm not sure you can get to that sandbox now?

@Domino987
Copy link
Contributor

Yes I cant see it. Thats annoying..

@KippWade
Copy link
Contributor Author

KippWade commented Feb 1, 2024

Should be able to see it now. They defaulted to everything to be private, and I just made it public.

@Domino987
Copy link
Contributor

Thanks, Ill check it out.

@KippWade
Copy link
Contributor Author

KippWade commented May 7, 2024

This is defiantly something to do with using parent/child. For some reason, the delete text just isn't inserted.

I've been looking through code, but haven't been able to find anything obvious as of yet.

@KippWade
Copy link
Contributor Author

KippWade commented May 7, 2024

In MTableEditRow, the localization that is passed on non group rows and the nested child rows are coming through differently. I'm trying to trace through where it is getting the different localization objects.

MTableEditRow:

Other edit rows when deleting, the localization.deleteText is displayed:
props:
localization:
{
"saveTooltip": "Save",
"cancelTooltip": "Cancel",
"deleteText": "Are you sure you want to delete this row?"
}

when it's child of child, there is no localization.deleteText in this object, but it's in localization.editRow.deleteText....
props:
localization:
{
"addToolTip": "Add",
"bulkEditApprove": "Save all changes",
"bulkEditCancel": "Discard all changes",
"bulkEditTooltip": "Edit All",
...
editRow: {
"cancelTooltip": "Cancel",
"dateTimePickerLocalization": undefined,
"deleteText": "Are you sure you want to delete this row?",
"saveTooltip": "Save",
...
}
...
}

@Domino987
Copy link
Contributor

That seems like an easy fix. Would you mind creating a PR to address this?

@KippWade
Copy link
Contributor Author

KippWade commented May 7, 2024

I will create one tonight. If found that if in MTableBodyRow I pass localization.editRow in the create element, it looks to work in every instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants