Skip to content

Conversation

@yamadayutaka
Copy link
Contributor

This PR is an implementation of the feature suggestion #359.

Specify the Column Option as follows.

{
  ...
  filterTooltipValueFn: (value: any) => {
    const d = dayjs(value || '');
    return d.isValid() ? d.format('L') : '';
  },
  ...
},

Then, the tooltip is displayed as follows.
image

@vercel
Copy link

vercel bot commented Jun 14, 2024

@yamadayutaka is attempting to deploy a commit to the Kevin Vandy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@alessandrojcm
Copy link
Collaborator

Hi @yamadayutaka thanks for your contribution, please see the comments I left.

@yamadayutaka
Copy link
Contributor Author

Hi @alessandrojcm thanks for your reply!
But I can't check your comments.
I think you may have forgotten to "Submit review".
Could you confirm this?

`"${
Array.isArray(column.getFilterValue())
? (column.getFilterValue() as [string, string]).join(
? (column.getFilterValue() as [])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure here about the type, if the previous type was casted as [string, string] then it should remain so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since filterTooltipValueFn does the conversion to string, I think the input to filterTooltipValueFn should remain the original data type.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok yeah agree, do you think you could type the prop accordingly then? Basically, I´d like to avoid using any when possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a type definition. What do you think of this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yamadayutaka could please add it to the prop? So it'd be filterToolValueFn?: (value: string) => string

enableEditing?: ((row: MRT_Row<TData>) => boolean) | boolean;
enableFilterMatchHighlighting?: boolean;
filterFn?: MRT_FilterFn<TData>;
filterTooltipValueFn?: (value: any) => string,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@alessandrojcm
Copy link
Collaborator

Hi @alessandrojcm thanks for your reply! But I can't check your comments. I think you may have forgotten to "Submit review". Could you confirm this?

Yes apologies, please check now.

Copy link
Collaborator

@alessandrojcm alessandrojcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry missed that you already typed the props (GH's UI can be very confusing sometimes...) Wil merge now thanks!

@alessandrojcm alessandrojcm merged commit de06f8a into KevinVandy:v2 Jul 17, 2024
@yamadayutaka
Copy link
Contributor Author

Thanks for merging!

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

Successfully merging this pull request may close these issues.

3 participants