javascript - D3.js method chaining command dosn't work when I split it, it works -


i new in d3.js, when use code doesn't work,(it part of redraw, when running first time works when calling redraw again works unexpextedly)

var rows=tbody.selectall('tr').data(roster); rows.enter().append('tr'); rows.exit().remove(); rows.selectall('td').data(function(row) { return columns.map(function(col) {   return row[col]; });}).enter().append('td').text(function(d) {return d;} ); 

when break chain down smaller works.

var rows=tbody.selectall('tr').data(roster); rows.enter().append('tr'); rows.exit().remove();  var cells = rows.selectall("td") .data(function(row) { return columns.map(function(col) {   return row[col]; });}); cells.enter().append("td"); cells.text(function(d) { return d; }); 

any reason or rule govern this.

in first case updating text on new cells, not old ones. when chain .enter() that, of following methods chained apply object returned .enter() , enter selection : added cells in other words.

read this


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -