DT icon indicating copy to clipboard operation
DT copied to clipboard

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

Open GitChub opened this issue 8 years ago • 5 comments

For example, I can use "formatPercentage" to format the values in a column to look like percentages (e.g. 2.50% (with "digits = 2") instead of 0.025), but the values shown on the filter slider still look unformatted (e.g. 0.025 instead of 2.50%).

GitChub avatar Mar 16 '16 06:03 GitChub

That is a very good question. I did consider this in the past, and it was not very straightforward to implement. I'll try again in the future. Thanks!

yihui avatar Mar 17 '16 19:03 yihui

I am having the same problem in this moment and I saw this. I take advantage to ask about a similar problem.

DT offer the possibility to use other column to order with "orderData" in "columnDefs". In my case column1 is order by column2 (this is hidden) because I am doing some modifications in the way of show column1.

Can filters input support the same ? Can I indicate that filter in column1 must to work with data of column2 (the hidden column) ?

Thanks in advance

ppagnone avatar Apr 10 '17 15:04 ppagnone

+1 to that

That's a minimal example, which helps to reproduce the problem.

runApp(
  list(ui = fluidPage(
    DT::dataTableOutput("mytable")
  ),
  server = function(input, output, session) {
    output$mytable <- DT::renderDataTable(
      DT::datatable(iris*10, 
                    options = list(pageLength = 10, 
                                   columnDefs = list(list(className = 'dt-left', 
                                                          targets = 0:4))
                                   ),
                    filter = c("top")) %>%
        formatRound(1:4, 0)
    )
  }
  )
)

screen shot 2018-08-09 at 12 45 14

dokato avatar Aug 09 '18 11:08 dokato

:+1: (A user tells me this today) Thanks in advance

philibe avatar Nov 29 '18 11:11 philibe

This is still a thing. Are the developers planning to fix this?

mrcaseb avatar Jul 29 '20 20:07 mrcaseb

Many thanks for the great package!

Any updates on this? Or is the recommended approach to use gt? (I see it has several pages about shiny)

llrs avatar Sep 04 '23 13:09 llrs

No updates. Sorry. If gt or any other packages can do the job, yes, please consider using them.

yihui avatar Sep 11 '23 16:09 yihui

Great new! @mikmart has just helped implement this feature. You can try the development version:

remotes::install_github('rstudio/DT')

Thanks everyone!

yihui avatar Jan 24 '24 02:01 yihui