Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Adds state override to resp table
Browse files Browse the repository at this point in the history
  • Loading branch information
acouch committed Sep 12, 2018
1 parent b59528b commit 87a7722
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/ResponsiveDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export default class ResponsiveDataTable extends BaseComponent {
return cols;
}

buildDataTable(data) {
buildDataTable(data) {
$.fn.dataTable.ext.errMode = 'none';

if ($.fn.DataTable.isDataTable(this.refs.main)) {
$(this.refs.main).DataTable().destroy();
$(this.refs.main).empty();
}
}
const tableEl = $(this.refs.main);
const cols = this.prepareDataCols(data);
const that = this;
Expand All @@ -53,10 +53,12 @@ export default class ResponsiveDataTable extends BaseComponent {
createdCell: function(td, cellData, rowData, row, col) {
const header = Object.keys(rowData)[col];

const columnOverrides = getProp('columns.' + header,
that.props.overrides);
const overrides = Object.assign({}, that.props.overrides, that.state.overrides);

const columnOverrides = getProp('columns.' + header,
overrides);
const cellOverrides = getProp('cells.' + header + '_' + row,
that.props.overrides);
overrides);
if (!isEmpty(columnOverrides)) {
$(td).addClass(columnOverrides.className);
}
Expand Down

0 comments on commit 87a7722

Please sign in to comment.