简体   繁体   中英

How can I rename the placeholder of in filter of a DT datatable in R?

library(DT)
data <- data.frame("Hi" = c("One","Two"), "Something" = c("A", "B"))
datatable(data, filter = 'top')

Translating a DT::datatable is nicely documented here . But, I am having trouble translating the placeholder on filter showing "ALL" in the example above. Does anyone have an idea how to change this?

It's not pretty, but until they enable this in their API, you could always clean up with javascript afterwards:

library(DT)
data <- data.frame("Hi" = c("One","Two"), "Something" = c("A", "B"))
datatable(
    data, filter = 'top',
    callback=JS('$(\'div.has-feedback input[type="search"]\').attr( "placeholder", "Alles" )')
)

Looks like this:

改变占位符

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM