Filter parameter from DT doesn't work with all the columns

Viewed 163

I am using DT package and filter='top' and I realised that some columns can give you the chance to click the different options of the column, but some columns don't give you that.

Here for example, you can click the options in the "am" column. However, if you try to do the same with the column named "model", you cannot.

image image3 image2

Does anyone know if there is way to have the same filter in the first column (model)?

The code:

library(DT)

mtcars2 = mtcars[c(1:3,9)]
mtcars2$am = factor(mtcars$am, c(0, 1), c('automatic', 'manual'))

datatable(
  mtcars2, colnames = c('model' = 1),
  filter = list(position = 'top', clear = FALSE),
  options = list(
    pageLength = 10
  )
)

Thanks in advance

Regards

0 Answers
Related