Skip to content

Commit

Permalink
generate proper table header
Browse files Browse the repository at this point in the history
fixes #1015
  • Loading branch information
gordonwoodhull committed Dec 22, 2015
1 parent fff2097 commit 44ad7ea
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/data-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,23 @@ dc.dataTable = function (parent, chartGroup) {
});

if (!bAllFunctions) {
_chart.selectAll('th').remove();
var headcols = _chart.root().selectAll('th')
// ensure one thead
var thead = _chart.selectAll('thead').data([0]);
thead.enter().append('thead');
thead.exit().remove();

// with one tr
var headrow = thead.selectAll('tr').data([0]);
headrow.enter().append('tr');
headrow.exit().remove();

// with a th for each column
var headcols = headrow.selectAll('th')
.data(_columns);
headcols.enter().append('th');
headcols.exit().remove();

var headGroup = headcols
.enter()
.append('th');

headGroup
headcols
.attr('class', HEAD_CSS_CLASS)
.html(function (d) {
return (_chart._doColumnHeaderFormat(d));
Expand Down

0 comments on commit 44ad7ea

Please sign in to comment.