Skip to content

Commit

Permalink
fix: disable columns filters not in use
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Murray <[email protected]>
  • Loading branch information
mikemurray committed Jan 17, 2020
1 parent 0f901ae commit 3527dd3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions package/src/components/DataTable/helpers/useDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,23 @@ export default function useDataTable({
const defaultColumn = React.useMemo(
() => ({
// Let's set up our default Filter UI
Filter: DefaultColumnFilter || (() => null)
Filter: DefaultColumnFilter || (() => null),
disableFilters: true
}),
[DefaultColumnFilter]
);

const updatedColumns = columns.map((column) => {
if (column.disableFilters !== true && (column.Filter || column.filter)) {
column.disableFilters = false;
}

return column;
});

const dataTableProps = useTable(
{
columns,
columns: updatedColumns,
data,
defaultColumn,
getRowId,
Expand Down

0 comments on commit 3527dd3

Please sign in to comment.