有没有人有关于如何将DT表上的"搜索框"移动到左侧和顶部标题的解决方案? 见图片 这里.该表位于 shinydashboard 应用程序上的 box(( 元素内(下面的代码(。谢谢!
body <- dashboardBody(
box(width = 6,
uiOutput ("clicked_country"),
div(DT::dataTableOutput("spCountyTable"),
style = "overflow-y: auto; height: 460px")))
)
server <- function(input, output, session){
output$spCountyTable <- DT::renderDataTable ({
filtereddata <-subset(county_speciesGroup2,county_speciesGroup2$County_Nm==input$County_Name)},
caption = 'Table 1: This is a simple caption for the table.',
extensions = c('ColReorder','FixedHeader'),
options = list(
paging = FALSE,
fixedHeader = TRUE,
colReorder = TRUE,
order = list(list(1, 'asc'))
)
}
这个想法..
library(DT)
library(shiny)
ui <- basicPage(
DT::dataTableOutput("mytable"),
tags$style(HTML(".dataTables_wrapper .dataTables_length {
float: right;}
.dataTables_wrapper .dataTables_filter {
float: left;
text-align: left;}"
)
)
)
server <- function(input, output) {
output$mytable = DT::renderDataTable({
mtcars})
}
shinyApp(ui, server)