如何解决将页脚移至Shiny R中DT底部
我有一个数据表,其中页脚带有“上一个/下一个”文本。当前,它与“显示15个中的1个”文本重叠。有没有办法移动这个,这样我就不会超圈?
这里是图片和代码。我对html / java脚本不是很熟悉,因此如果您可以提供一个答案,说明您为什么使用特定的代码,将不胜感激
library(shiny)
library(bs4Dash)
library(DT)
x = data.frame(one = rep("Hey how is everyones day? I need some help on this shiny application and learn how to use some of the features on datatable.",10),two = rep("this is the second column of text. ",three = rep("this is the third column of text",10))
ui = bs4DashPage(
old_school = FALSE,sidebar_min = TRUE,sidebar_collapsed = FALSE,controlbar_collapsed = FALSE,controlbar_overlay = TRUE,title = "Basic Dashboard",navbar = bs4DashNavbar(),sidebar = bs4DashSidebar(),controlbar = bs4DashControlbar(),footer = bs4DashFooter(),body = bs4DashBody(
DTOutput("table")
)
)
server = function(input,output) {
output$table = renderDataTable({
datatable(x,rownames = F,style = "bootstrap",extensions = 'Responsive',options = list(
#dom = 't'
))
})
}
shinyApp(ui,server)
当我在闪亮的仪表板上运行相同的代码时,它的显示方式就是我希望它看起来像的样子。因此,我认为这与Bs4Dash样式表有关。以下是使用闪亮仪表板的外观
解决方法
您需要在初始化后重新绘制表。
$('#tableIdHere').DataTable().draw();
,
您可以尝试一下,希望它能解决您的问题。
library(shiny)
library(bs4Dash)
library(DT)
x = data.frame(one = rep("Hey how is everyones day? I need some help on this shiny application and learn how to use some of the features on datatable.",10),two = rep("this is the second column of text. ",three = rep("this is the third column of text",10))
ui = bs4DashPage(
old_school = FALSE,sidebar_min = TRUE,sidebar_collapsed = FALSE,controlbar_collapsed = FALSE,controlbar_overlay = TRUE,title = "Basic Dashboard",navbar = bs4DashNavbar(),#sidebar = bs4DashSidebar(),controlbar = bs4DashControlbar(),footer = bs4DashFooter(),body = bs4DashBody(
DTOutput("table")
)
)
server = function(input,output) {
output$table = renderDataTable({
datatable(x,rownames = F,extensions = 'Responsive',options = list(
#dom = 't'
))
})
}
shinyApp(ui,server)
我只从style = "bootstrap"
中删除了renderDataTable
,并且起到了作用
您的CSS被其他一些默认CSS覆盖。请检查您的班级是否命名相似或彼此冲突。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。