score:2

selections in d3 are immutable. therefore, this:

tr.merge(tr.enter().append("tr"));

... won't change what tr is. since you obviously want it to be the "update + enter" selections, you have to reassign it:

tr = tr.merge(tr.enter().append("tr"));

finally, i'd advise naming the enter selection, so the whole thing would be:

var trenter = tr.enter().append("tr");
tr = tr.merge(trenter);

Related Query

More Query from same tag