diff --git a/README.md b/README.md index 4b69dc0..83ecd6b 100644 --- a/README.md +++ b/README.md @@ -137,12 +137,16 @@ The `sematable(tableName, component, columns, configs)` wrapper accepts three pa - _columns_ is an array of column definitions - _configs_ is an optional object where you can specify configuration properties -Configuration properties: +### Configuration properties: - _showPageSize_ if page size select should be shown - _showFilter_ if text filter field should be shown - _defaultPageSize_ overrides the default page size (if not specified 5 will be used) - _autoHidePagination_ if pagination should be hidden if the number of pages is 1 (default is true, which means pagination is hidden if the number of pages is equal to 1) + - _filterClassName_ css class for the filter component + - _filterContainerClassName_ css class for the filter component container element ('col-md-6' by default) + - _pageSizeClassName_ css class for the page size component ('col-md-6' by default) + - _pageSizeContainerClassName_ css class for the page size component container element ('col-md-6' by default) There's no requirement that the wrapped component needs to be a table, it could be a list, a div, an image gallery, or anything else. diff --git a/src/Filter.js b/src/Filter.js index 5d2d825..6696569 100644 --- a/src/Filter.js +++ b/src/Filter.js @@ -7,6 +7,7 @@ const propTypes = { onChange: PropTypes.func.isRequired, onTextChange: PropTypes.func.isRequired, options: PropTypes.array.isRequired, + className: PropTypes.string, }; class Filter extends Component { @@ -24,9 +25,11 @@ class Filter extends Component { onChange, onTextChange, options, + className, } = this.props; return ( { showPageSize = true, showFilter = true, autoHidePagination = true, + pageSizeContainerClassName = 'col-md-6', + filterContainerClassName = 'col-md-6', + pageSizeClassName, + filterClassName, } = configs; if (!isInitialized) { @@ -178,14 +182,16 @@ const sematable = (tableName, TableComponent, columns, configs = {}) => { return (
-
+
{showPageSize && onPageSizeChange(f)} />}
-
+
{showFilter && onFilterChange(f)}