From 1ea677331c4bd76a43573bdbd5b92917bc6386c0 Mon Sep 17 00:00:00 2001 From: Hugo Bove <52443771+huboneo@users.noreply.github.com> Date: Mon, 14 Oct 2019 16:25:22 +0100 Subject: [PATCH] fix(usegroupby): column.disableGrouping inverted logic (#1596) unlike other hooks, the column.disableGrouping actually enabled grouping for a column --- docs/api.md | 4 ++-- src/plugin-hooks/useGroupBy.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api.md b/docs/api.md index 44ee2fc..dab9dbd 100644 --- a/docs/api.md +++ b/docs/api.md @@ -575,8 +575,8 @@ The following options are supported on any `Column` object passed to the `column - Must return valid JSX - This function (or component) formats this column's value when it is being grouped and aggregated, eg. If this column was showing the number of visits for a user to a website and it was currently being grouped to show an **average** of the values, the `Aggregated` function for this column could format that value to `1,000 Avg. Visits` - `disableGrouping: Boolean` - - Defaults to `true` - - If `true`, this column is able to be grouped. + - Defaults to `false` + - If `true`, will disable grouping for this column. ### Instance Properties diff --git a/src/plugin-hooks/useGroupBy.js b/src/plugin-hooks/useGroupBy.js index 3182dfa..7f362ec 100755 --- a/src/plugin-hooks/useGroupBy.js +++ b/src/plugin-hooks/useGroupBy.js @@ -93,7 +93,7 @@ function useMain(instance) { column.canGroupBy = accessor ? getFirstDefined( - columnDisableGrouping, + columnDisableGrouping === true ? false : undefined, disableGrouping === true ? false : undefined, true )