From 712eeca69531bdcc50dbac3fc63f8089064d3e2f Mon Sep 17 00:00:00 2001 From: David May Date: Mon, 21 Mar 2022 12:08:08 -0700 Subject: [PATCH] Propogate non-footable classes on columns to the column's detail-row. --- src/js/classes/FooTable.Cell.js | 4 +++- src/js/classes/FooTable.Column.js | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/js/classes/FooTable.Cell.js b/src/js/classes/FooTable.Cell.js index 781a4d09..c1b1c8e8 100644 --- a/src/js/classes/FooTable.Cell.js +++ b/src/js/classes/FooTable.Cell.js @@ -106,7 +106,9 @@ this._setClasses(this.$el); this._setStyle(this.$el); - this.$detail = $('').addClass(this.row.classes.join(' ')) + /* Non-FooTable column classes should be transferred to the details row */ + trClasses = this.row.classes.concat(this.column.nonFTClasses) + this.$detail = $('').addClass(trClasses.join(' ')) .data('__FooTableCell__', this) .append($('')) .append($('')); diff --git a/src/js/classes/FooTable.Column.js b/src/js/classes/FooTable.Column.js index c7063fca..a58f4dd6 100644 --- a/src/js/classes/FooTable.Column.js +++ b/src/js/classes/FooTable.Column.js @@ -105,6 +105,11 @@ * @type {Array.} */ this.classes = F.is.array(definition.classes) ? definition.classes : (F.is.string(definition.classes) ? definition.classes.match(/\S+/g) : []); + /** + * The "user" supplied classes on the column. Will be applied to the colunn detail row if applicable + * @type {Array.} + */ + this.nonFTClasses = this.$el[0].classList.value.split(' ').filter(function(c) { return c && !c.startsWith('footable') }); // override any default functions ensuring when they are executed "this" within the context of the function points to the instance of this object. this.parser = F.checkFnValue(this, definition.parser, this.parser); @@ -169,4 +174,4 @@ F.columns.register('text', F.Column); -})(jQuery, FooTable); \ No newline at end of file +})(jQuery, FooTable);