Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propogate non-footable classes on columns to the column's detail-row. #892

Open
wants to merge 1 commit into
base: V3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/js/classes/FooTable.Cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@
this._setClasses(this.$el);
this._setStyle(this.$el);

this.$detail = $('<tr/>').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 = $('<tr/>').addClass(trClasses.join(' '))
.data('__FooTableCell__', this)
.append($('<th/>'))
.append($('<td/>'));
Expand Down
7 changes: 6 additions & 1 deletion src/js/classes/FooTable.Column.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
* @type {Array.<string>}
*/
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.<string>}
*/
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);
Expand Down Expand Up @@ -169,4 +174,4 @@

F.columns.register('text', F.Column);

})(jQuery, FooTable);
})(jQuery, FooTable);