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

Apply column formats to slider labels #1119

Merged
merged 5 commits into from
Jan 24, 2024
Merged

Conversation

mikmart
Copy link
Contributor

@mikmart mikmart commented Jan 24, 2024

Fixes #247.

The format* functions append new columnDefs entries with customized renderer functions to apply column formatting. The idea in this PR is to fetch those same renderer functions to apply to filter slider labels.

DT::datatable(
  tibble::tibble(
    goal_completion = round(runif(10), 2),
    bonus = goal_completion * 15:24 * 1000,
    payday = Sys.Date() + 1:10
  ),
  filter = "top"
) |>
  DT::formatPercentage(1) |>
  DT::formatCurrency(2) |>
  DT::formatDate(3)

rstudio_q1oywttPsw

Copy link
Member

@yihui yihui left a comment

Choose a reason for hiding this comment

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

Implementing a feature requested from eight (!) years ago... How awesome is that! Plus, the implementation is much more elegant than what I have thought before. Thank you so much!

@yihui yihui merged commit 2476bf7 into rstudio:main Jan 24, 2024
10 checks passed
@mikmart
Copy link
Contributor Author

mikmart commented Jan 24, 2024

Thank you for the kind words!

I think with these changes the previously special-cased date formatting can also be simplified. I'm planning to have a stab at refactoring that in another PR.

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.

Is it possible to have the column formatting also apply to values shown in filter sliders?
2 participants