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

Time Column Filter in Dashboard does not respect sorting filter values #31585

Open
cougrimes opened this issue Dec 20, 2024 · 2 comments
Open
Labels
dashboard:filtersets Related to the filtersets of the Dashboard

Comments

@cougrimes
Copy link

cougrimes commented Dec 20, 2024

Screenshot

time_filter

Description

Bug: Using the 'Time column' filter for dashboards in conjunction with 'Sort Filter Values' results in no sorting.

In the screenshot above, I have six different temporal columns in the table. Their column names and labels are the following:

Column Name Column Label
lead_created_at Lead Created At
mkto_acquisition_at Marketo Acquisition Datetime
mkto_acquisition_date Marketo Acquisition Date
lead_updated_at Lead Updated At
activity_date Activity Date
activity_at Activity Timestamp

When using the Filter Configuration -> Sort filter values option in Add and Edit Filters, I would expect one of two behaviors:

  • Values sorted would sort on the Column Label
  • Values sorted would sort on the Column Name

However, neither of these behaviors occur; regardless of whether sort is applied as ascending or descending, the values do not sort in the picklist.

I have tested this behavior in Superset 4.0.0 and have confirmed across multiple deployments.

Design input

I would expect the ideal design pattern here to first sort based on Column Label, and if no value is provided, the raw Column Name.

Copy link

dosubot bot commented Dec 20, 2024

Hello @cougrimes! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together!

The issue you're experiencing with the 'Time column' filter not respecting the 'Sort Filter Values' option in Superset seems to be related to the implementation of sorting logic for filter values. The current implementation of the 'Time column' filter uses a Select component to display options, but there is no specific mention of sorting logic being applied to these options in the available code snippets [1][2].

To address this, you might need to check if the sorting logic is correctly implemented in the Select component or if additional logic is required to sort the options based on the Column Label or Column Name. It could be beneficial to review the onSortChanged function and ensure it is correctly updating the state to reflect the desired sorting order [3].

If the sorting logic is not present or not functioning as expected, you may need to implement custom sorting logic within the handleChange function or wherever the options are being set for the Select component. This would involve sorting the options array before it is passed to the Select component, based on your preferred criteria (Column Label first, then Column Name if no label is provided).

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the dashboard:filtersets Related to the filtersets of the Dashboard label Dec 20, 2024
@rusackas
Copy link
Member

Not sure if @michael-s-molina @kgabryje @villebro have any time to look at this, but they were the ones that worked in or around this feature a couple years back, so here's a ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:filtersets Related to the filtersets of the Dashboard
Projects
None yet
Development

No branches or pull requests

2 participants