diff --git a/src/DataTable/README.md b/src/DataTable/README.md index 22c9a2ea848..6dd25c56c3e 100644 --- a/src/DataTable/README.md +++ b/src/DataTable/README.md @@ -53,97 +53,98 @@ or a filter component can be defined on the column. See - - + Header: 'Coat Color', + accessor: 'color', + Filter: CheckboxFilter, + filter: 'includesValue', + filterChoices: Object.values(reducedChoices), + }, + ]} + > + + + + + + ); +} ``` ## Backend filtering and sorting @@ -360,19 +361,6 @@ See ``dataViewToggleOptions`` props documentation for all supported props. famous_for: 'modeling', }, ], []) - const reducedChoices = data.reduce((acc, currentObject) => { - const { color } = currentObject; - if (color in acc) { - color.number += 1; - } else { - acc[color] = { - name: color, - number: 1, - value: color, - }; - } - return acc; -}, {}); return ( @@ -468,18 +470,13 @@ See ``dataViewToggleOptions`` props documentation for all supported props. Filter: CheckboxFilter, filter: 'includesValue', filterChoices: [{ - name: 'russian white', - number: 1, - value: 'russian white', - }, - { name: 'orange tabby', - number: 2, + number: 1, value: 'orange tabby', }, { name: 'brown tabby', - number: 3, + number: 1, value: 'brown tabby', }, { @@ -1275,18 +1272,13 @@ For a more desktop friendly view, you can move filters into a sidebar by providi Filter: CheckboxFilter, filter: 'includesValue', filterChoices: [{ - name: 'russian white', - number: 1, - value: 'russian white', - }, - { name: 'orange tabby', number: 2, value: 'orange tabby', }, { name: 'brown tabby', - number: 3, + number: 2, value: 'brown tabby', }, {