diff --git a/js/components/ascribe_table/table_header.js b/js/components/ascribe_table/table_header.js
index a4e68879..8176ad31 100644
--- a/js/components/ascribe_table/table_header.js
+++ b/js/components/ascribe_table/table_header.js
@@ -23,7 +23,7 @@ let TableHeader = React.createClass({
{this.props.columnList.map((val, i) => {
- let columnClasses = this.calcColumnClasses(this.props.columnList, i);
+ let columnClasses = this.calcColumnClasses(this.props.columnList, i, 12);
let columnName = this.props.columnList[i].columnName;
let canBeOrdered = this.props.columnList[i].canBeOrdered;
diff --git a/js/components/ascribe_table/table_item.js b/js/components/ascribe_table/table_item.js
index 23f91201..89e9fbbe 100644
--- a/js/components/ascribe_table/table_item.js
+++ b/js/components/ascribe_table/table_item.js
@@ -18,7 +18,7 @@ let TableItem = React.createClass({
return this.props.columnList.map((column, i) => {
let TypeElement = column.displayType;
- let columnClass = this.calcColumnClasses(this.props.columnList, i);
+ let columnClass = this.calcColumnClasses(this.props.columnList, i, 12);
return (
diff --git a/js/components/ascribe_table/table_item_subtable.js b/js/components/ascribe_table/table_item_subtable.js
index 70f8fbee..a4643d3e 100644
--- a/js/components/ascribe_table/table_item_subtable.js
+++ b/js/components/ascribe_table/table_item_subtable.js
@@ -56,7 +56,7 @@ let TableItemSubtable = React.createClass({
return this.props.columnList.map((column, i) => {
let TypeElement = column.displayType;
- let columnClass = this.calcColumnClasses(this.props.columnList, i);
+ let columnClass = this.calcColumnClasses(this.props.columnList, i, 12);
return (
diff --git a/js/mixins/table_column_mixin.js b/js/mixins/table_column_mixin.js
index 5904389d..d74214e1 100644
--- a/js/mixins/table_column_mixin.js
+++ b/js/mixins/table_column_mixin.js
@@ -7,14 +7,14 @@ let TableColumnMixin = {
* Generates the bootstrap grid column declarations automatically using
* the columnMap.
*/
- calcColumnClasses(list, i) {
+ calcColumnClasses(list, i, numOfColumns) {
let bootstrapClasses = ['col-xs-', 'col-sm-', 'col-md-', 'col-lg-'];
let listOfRowValues = list.map((column) => column.rowWidth );
- let numOfColumns = GeneralUtils.sumNumList(listOfRowValues);
+ let numOfUsedColumns = GeneralUtils.sumNumList(listOfRowValues);
- if(numOfColumns > 12) {
- throw new Error('Bootstrap has only 12 columns to assign. You defined ' + numOfColumns + '. Change this in the columnMap you\'re passing to the table.')
+ if(numOfUsedColumns > numOfColumns) {
+ throw new Error('This table has only ' + numOfColumns + ' columns to assign. You defined ' + numOfUsedColumns + '. Change this in the columnMap you\'re passing to the table.')
} else {
return bootstrapClasses.join( listOfRowValues[i] + ' ') + listOfRowValues[i];
}