Skip to content

getFacetedMinMaxValues does not work correctly #5542

Answered by devmoatassem
BigSillyTiger asked this question in Q&A
Discussion options

You must be logged in to vote

I have made a workaround, I am sure getFacetedMinMaxValues is also doing same but poorly
Sharing the snippet maybe if it's helpful to you

  const allValues = column?.getFacetedUniqueValues() ?? new Map();
  const maxV = Math.max(
    ...Array.from(allValues.keys(), (value) => {
      const num = Number(value);
      return isNaN(num) ? 0 : num;
    })
  );

  const minV = Math.min(
    ...Array.from(allValues.keys(), (value) => {
      const num = Number(value);
      return isNaN(num) ? 0 : num;
    })
  );

You may handle these values with the help of useEffect and useState depending on your use-case

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@BigSillyTiger
Comment options

@devmoatassem
Comment options

Answer selected by BigSillyTiger
@BigSillyTiger
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants