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

Allow user to customize the hardcoded wrapper Component. #1995

Open
wants to merge 2 commits into
base: master
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
8 changes: 6 additions & 2 deletions src/MUIDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import isUndefined from 'lodash.isundefined';
import merge from 'lodash.merge';
import PropTypes from 'prop-types';
import React from 'react';
import DefaultReactiveWrapper from './components/ReactiveWrapper';
import DefaultTableBody from './components/TableBody';
import DefaultTableFilter from './components/TableFilter';
import DefaultTableFilterList from './components/TableFilterList';
Expand Down Expand Up @@ -262,6 +263,7 @@ class MUIDataTable extends React.Component {
data: [],
columns: [],
components: {
ReactiveWrapper: DefaultReactiveWrapper,
TableBody: DefaultTableBody,
TableFilter: DefaultTableFilter,
TableFilterList: DefaultTableFilterList,
Expand Down Expand Up @@ -1828,6 +1830,7 @@ class MUIDataTable extends React.Component {
className,
title,
components: {
ReactiveWrapper,
TableBody,
TableFilterList,
TableFooter,
Expand Down Expand Up @@ -1856,6 +1859,7 @@ class MUIDataTable extends React.Component {
columnOrder,
} = this.state;

const ReactiveWrapperComponent = ReactiveWrapper || DefaultReactiveWrapper;
const TableBodyComponent = TableBody || DefaultTableBody;
const TableFilterListComponent = TableFilterList || DefaultTableFilterList;
const TableFooterComponent = TableFooter || DefaultTableFooter;
Expand Down Expand Up @@ -1987,7 +1991,7 @@ class MUIDataTable extends React.Component {
filterUpdate={this.filterUpdate}
columnNames={columnNames}
/>
<div style={{ position: 'relative', ...tableHeightVal }} className={responsiveClass}>
<ReactiveWrapperComponent style={{ position: 'relative', ...tableHeightVal }} className={responsiveClass}>
{(this.options.resizableColumns === true ||
(this.options.resizableColumns && this.options.resizableColumns.enabled)) && (
<TableResizeComponent
Expand Down Expand Up @@ -2070,7 +2074,7 @@ class MUIDataTable extends React.Component {

return components;
})()}
</div>
</ReactiveWrapperComponent>
<TableFooterComponent
options={this.options}
page={page}
Expand Down
6 changes: 6 additions & 0 deletions src/components/ReactiveWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';

const fn = (props) => {
return (<div {...props} />);
};
export default fn;