空的“行流体” div在dataTableOutput的顶部和底部 [英] Empty "row-fluid" div at top and bottom of dataTableOutput

查看:142
本文介绍了空的“行流体” div在dataTableOutput的顶部和底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个闪亮的例子,使用renderDataTable()创建输出。



我已经删除了所有可能的选项(分页,过滤,搜索等)。但是,我的表格输出的顶部和底部现在有一个空行,过滤和搜索过去是。



如何将这两个div从在datatable包装内,只有当我删除了过滤和搜索选项?



ui.R:

库(闪亮)
ShinyUI(pageWithSidebar(
headerPanel(dataTable示例),
sidebarPanel(
这是一个边栏
),
mainPanel(
p(查看下面的差距),
wellPanel(
dataTableOutput('example1')),
p(
wellPanel(
dataTableOutput('example2')




server.R:

 code> library(shiny)
ShinyServer(function(input,output){
x <-c(1,2,3,4,5)
y <-c 'a','b','c','d','e')
test< -data.frame(x,y)
输出$ example1< -renderDataTable({test},options = list(iDisplayLength = 5,bSearchable = FALSE
,bFilter = FALSE,bPaginate = FALSE ,bAutoWidth = TRUE
,bInfo = 0,bSort = 0))
输出$ example2< -renderDataTable({test})
})


解决方案

您可以使用 sDom 选项参见 http://legacy.datatables.net/usage/options#sDom 了解更多详情:

 库(闪亮)
runApp(list(ui = pageWithSidebar(
headerPanel(dataTable Example) ,
sidebarPanel(
这是一个边栏
),
mainPanel(
p(查看下面的差距),
wellPanel
dataTableOutput('example1')),
p(无差距这里是因为搜索和寻呼。),
wellPanel(
dataTableOutput('example2')



,server = function输入,输出){
x <-c(1,2,3,4,5)
y <-c('a','b','c','d' e')
测试< -data.frame(x,y)
输出$ example1< -renderDataTable({test},options = list(iDisplayLength = 5,bSearchable = FALSE
,bFilter = FALSE,bPaginate = FALSE,bAutoWidth = TRUE
,bInfo = 0,bSort = 0
,sDom=rt
))
输出$ example2 <-renderDataTable ({test})
}


< img src =https://i.stack.imgur.com/VzkBm.pngalt =在此输入图像说明>


I have a shiny example using renderDataTable() to create an output.

I have removed all possible options (paging, filtering, searching, etc). However, there is now a blank row at the top and bottom of my table output, where the filtering and searching used to be.

How can I remove these two divs from inside the datatable wrapper, only when I have removed the filtering and searching options?

ui.R:

library(shiny)
shinyUI(pageWithSidebar(
  headerPanel("dataTable Example"),
  sidebarPanel(
    "This is a sidebar"
  ),
  mainPanel(
    p("Check out the gaps below."),
    wellPanel(
               dataTableOutput('example1')),
    p("No gaps here because of searching and paging."),
    wellPanel(
               dataTableOutput('example2')
        )
    )
  )
)

server.R:

library(shiny)
    shinyServer(function(input, output) {
      x<-c(1,2,3,4,5)
      y<-c('a','b','c','d','e')
      test<-data.frame(x,y)
      output$example1<-renderDataTable({test},options = list(iDisplayLength = 5,bSearchable = FALSE
                                                            ,bFilter=FALSE,bPaginate=FALSE,bAutoWidth=TRUE
                                                            ,bInfo=0,bSort=0))  
      output$example2<-renderDataTable({test})  
    })

解决方案

You can use the sDom option see http://legacy.datatables.net/usage/options#sDom for more details:

library(shiny)
runApp(list( ui =pageWithSidebar(
  headerPanel("dataTable Example"),
  sidebarPanel(
    "This is a sidebar"
  ),
  mainPanel(
    p("Check out the gaps below."),
    wellPanel(
      dataTableOutput('example1')),
    p("No gaps here because of searching and paging."),
    wellPanel(
      dataTableOutput('example2')
    )
  )
)
, server = function(input, output) {
  x<-c(1,2,3,4,5)
  y<-c('a','b','c','d','e')
  test<-data.frame(x,y)
  output$example1<-renderDataTable({test},options = list(iDisplayLength = 5,bSearchable = FALSE
                                                         ,bFilter=FALSE,bPaginate=FALSE,bAutoWidth=TRUE
                                                         ,bInfo=0,bSort=0
                                                         , "sDom" = "rt"
                                                         ))  
  output$example2<-renderDataTable({test})  
}
)
)

这篇关于空的“行流体” div在dataTableOutput的顶部和底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆