Skip to content

Commit

Permalink
Don't put .expander class on a column if it has a nested row
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Feb 11, 2016
1 parent 37f68ed commit 7038eb8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/makeColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = function(col) {
var output = '';
var inner = $(col).html();
var classes = [];
var thClass = '';

// Add 1 to include current column
var colCount = $(col).siblings().length + 1;
Expand All @@ -32,16 +33,21 @@ module.exports = function(col) {
if (!$(col).prev(this.components.columns).length) classes.push('first');
if (!$(col).next(this.components.columns).length) classes.push('last');

// If the column contains a nested row, the .expander class should not be used
if (!col.find('.row, row').length) {
thClass = ' class="expander"';
}

// Final HTML output
output = multiline(function() {/*
<th class="%s">
<table>
<tr>
<th class="expander">%s</th>
<th%s>%s</th>
</tr>
</table>
</th>
*/});

return format(output, classes.join(' '), inner);
return format(output, classes.join(' '), thClass, inner);
}

0 comments on commit 7038eb8

Please sign in to comment.