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

Error in Documentation - Custom Faceted Values - getFacetedUniqueValues and getFacetedMinMaxValues #1322

Open
1 task done
BigSamu opened this issue Dec 5, 2024 · 0 comments

Comments

@BigSamu
Copy link

BigSamu commented Dec 5, 2024

material-react-table version

N/A

react & react-dom versions

N/A

Describe the bug and the steps to reproduce it

For the examples codes in the documentation section Custom Faceted Values, the functions getFacetedUniqueValues and getFacetedMinMaxValues expects as return a callback that returns a Map/Array and not a Map/Array itself, respectivetely. Below is a screenshot from the source code

image

The correct example in the doc should be

const table = useMaterialReactTable({
  columns,
  data,
  enableFacetedValues: true,
  //if using server-side pagination and filtering
  getFacetedMinMaxValues: (table) => {
    //fetch min and max values from server
    return () => [minValue, maxValue];
  },
  //if using server-side filtering
  getFacetedUniqueValues: (table) => {
    const uniqueValueMap = new Map<string, number>();
    //fetch unique values from server, ideally including the count of each unique value
    return () => uniqueValueMap;
  },
})

Also I wonder why the return of a callback, instead of a direct Map/Array for this functions. Is there any explanation on that?

Minimal, Reproducible Example - (Optional, but Recommended)

N/A

Screenshots or Videos (Optional)

N/A

Do you intend to try to help solve this bug with your own PR?

None

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant