最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - select box cell renderer does not update when deleting a react table row - Stack Overflow

programmeradmin0浏览0评论

Could you please take a look into the tiny sandbox project?

I have a simple react table, each row contains a "raw" data and the same data as a select box value. when I delete a row, the table is rerendered correctly, the "raw" data is displayed correctly, but the selected value in the select boxes stay unchanged. Why?

Thanks in advance!

P.S. when I try to change the Select attribute from "defaultValue" to "value", the row deletion start to work correctly, but in this case it is not possible any more to modify the selectbox value.

Could you please take a look into the tiny sandbox project?

https://codesandbox.io/p/sandbox/festive-nova-s58h2v

I have a simple react table, each row contains a "raw" data and the same data as a select box value. when I delete a row, the table is rerendered correctly, the "raw" data is displayed correctly, but the selected value in the select boxes stay unchanged. Why?

Thanks in advance!

P.S. when I try to change the Select attribute from "defaultValue" to "value", the row deletion start to work correctly, but in this case it is not possible any more to modify the selectbox value.

Share Improve this question edited Mar 28 at 12:16 Andrei Isakov asked Mar 28 at 7:56 Andrei IsakovAndrei Isakov 591 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I managed to resolve the issue. I added an "external" onChange handler to my select box properties. The handler comes from the parent table and it rewrites the columns model on the update event. The sandbox project now works as expected

发布评论

评论列表(0)

  1. 暂无评论