d3 / d3-selection

Transform the DOM by selecting elements and joining to data.

Home Page:https://d3js.org/d3-selection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When binding data to a subelement, it is bound on enter, but not updated on update.

basbloemsaat opened this issue · comments

Not really sure if this is a bug, but is is unexpected behavior to me.

When I create a table and I bind data to the tr element, on enter() the td elements have access to the data of the tr. However, when I update the data on the tr, the td's data isn't updated, instead it keeps referencing the old data.

I made a block to demonstrate: https://bl.ocks.org/basbloemsaat/0b67317b33aeba2ce6e41116c3118b48

I checked: in line 54 the right data is bound, however, the texts aren't updated.

You must rebind the children using selection.data to give them the new data. I’m pretty sure this is covered in the README (and various tutorials and also motivations discussed in other issues).