AllenFang / react-bootstrap-table

A Bootstrap table built with React.js
https://allenfang.github.io/react-bootstrap-table/
MIT License
2.23k stars 782 forks source link

Delete rows in nested / expanded array not working #1614

Open Paul6552 opened 7 years ago

Paul6552 commented 7 years ago

Hello community, after three days I would need help pls. I have an array with a nested Array in it. My main goal is to delete or add rows in the nested array.

We can start with this example, its almost the same: Example expandRow In this example my goal would be to delete all rows in the inner array "expand" (fieldA:test1,...)

I have modified this example only with three things: insertRow, deleteRow and selectRow={ selectRowTableTaenze } thereby we can select and delete a row.

Lets have a look on the fiddle now: https://jsfiddle.net/9cqubzgd/

Now in our example we have 5 rows. We click on the first row "Item name 1". We see in the expanded table the values "fieldA", "fieldB" ... and so on WITH the new buttons insertRowand deleteRow. Now we delete all rows in the inner table (test1, test2) -> now we should have "Item name 1" with NO inner rows.

But if we click now on "Item name 2" and click back to "item name 1" all rows from the inner Array are back in "item name 1".

Hopefully clear what I mean and thank you for your time

AllenFang commented 7 years ago

@Paul6552 i'm sorry for lately reply.

Firstly, this is actually, a bug from react-bootstrap-table have expandable row feature. Because I doesn't consider the data change in the table of expanding row, actually, this bug is expected for me, because, the source data doesn't mutate/update.

As I mention at homepage, https://github.com/AllenFang/react-bootstrap-table I'm doing the next generation of react-bootstrap-table to build up a more lightweight and easy to customizable table component, and also this bug will be fix in react-bootstrap-table2.

Anyway, it's too late to fix this kind of issue in this repo, I didn't consider/think more, this is architecture problem.