renderDatatable в блестящем, давая искаженный фильтр - PullRequest
0 голосов
/ 16 октября 2018

Кажется, я не могу понять эту проблему, связанную с таблицей данных в моем блестящем приложении ... Фильтр в верхней части renderDatatable дает искаженный вид.См. Ниже: enter image description here

Пример данных и код:

roadsalt_data<-structure(list(orgid = c("NJDEP_BFBM", "NJDEP_BFBM", "NJDEP_BFBM", 
"NJDEP_BFBM", "NJDEP_BFBM", "BTMUA", "NJDEP_BFBM", "BTMUA", "USGS-NJ", 
"BTMUA"), locid = c("NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", 
"NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", 
"BTMUA-INTAKE", "NJDEP_BFBM-NJW04459-254-2", "BTMUA-INTAKE", 
"USGS-01378600", "BTMUA-INTAKE"), stdate = structure(c(15664, 
15664, 15664, 15664, 15664, 14173, 15664, 14174, 13570, 14176
), class = "Date"), sttime = structure(c(43560, 43680, 43740, 
43380, 43260, 40920, 45000, 36420, 37200, 37800), class = c("hms", 
"difftime"), units = "secs"), charnam = c("Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance"
), val = c(26200, 26200, 26200, 25700, 23800, 23039, 22000, 20981, 
16000, 15543), valunit = c("uS/cm @25C", "uS/cm @25C", "uS/cm @25C", 
"uS/cm @25C", "uS/cm @25C", "uS/cm @25C", "uS/cm @25C", "uS/cm @25C", 
"uS/cm @25C", "uS/cm @25C"), swqs = c("FW2-NT", "FW2-NT", "FW2-NT", 
"FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT"
), WMA = c(5L, 5L, 5L, 5L, 5L, 13L, 5L, 13L, 5L, 13L), year = c(2012L, 
2012L, 2012L, 2012L, 2012L, 2008L, 2012L, 2008L, 2007L, 2008L
), locid2 = c("NJW04459-254-1", "NJW04459-254-1", "NJW04459-254-1", 
"NJW04459-254-1", "NJW04459-254-1", "INTAKE", "NJW04459-254-2", 
"INTAKE", "01378600", "INTAKE")), .Names = c("orgid", "locid", 
"stdate", "sttime", "charnam", "val", "valunit", "swqs", "WMA", 
"year", "locid2"), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame"))

library(shiny)
library(shinydashboard)

header<- dashboardHeader()
sidebar<- dashboardSidebar()
body<- dashboardBody(DT::dataTableOutput("Table1"))

ui<-dashboardPage(header, sidebar, body)

server<- function(input,output,session){
  output$Table1<- DT::renderDataTable({
    DT::datatable(roadsalt_data,filter = 'top')
  })
}

shinyApp(ui = ui, server = server)

1 Ответ

0 голосов
/ 16 октября 2018

Это происходит, когда ваше приложение не умещается на экране должным образом.Вот как это выглядит на моем 15-дюймовом ноутбуке: undistorted filter

Однако при увеличении (аналогично меньшему экрану) происходит искажение.Вы можете отредактировать код для следующего, и он должен создать полосу прокрутки вместо искажения:

DT::datatable(roadsalt_data,filter = 'top', options = list(scrollX = TRUE))

Обновление

Включает полный код

roadsalt_data<-structure(list(orgid = c("NJDEP_BFBM", "NJDEP_BFBM", "NJDEP_BFBM", 
"NJDEP_BFBM", "NJDEP_BFBM", "BTMUA", "NJDEP_BFBM", "BTMUA", "USGS-NJ", 
"BTMUA"), locid = c("NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", 
"NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", "NJDEP_BFBM-NJW04459-254-1", 
"BTMUA-INTAKE", "NJDEP_BFBM-NJW04459-254-2", "BTMUA-INTAKE", 
"USGS-01378600", "BTMUA-INTAKE"), stdate = structure(c(15664, 
15664, 15664, 15664, 15664, 14173, 15664, 14174, 13570, 14176
), class = "Date"), sttime = structure(c(43560, 43680, 43740, 
43380, 43260, 40920, 45000, 36420, 37200, 37800), class = c("hms", 
"difftime"), units = "secs"), charnam = c("Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance", 
"Specific conductance", "Specific conductance", "Specific conductance"
), val = c(26200, 26200, 26200, 25700, 23800, 23039, 22000, 20981, 
16000, 15543), valunit = c("uS/cm @25C", "uS/cm @25C", "uS/cm @25C", 
"uS/cm @25C", "uS/cm @25C", "uS/cm @25C", "uS/cm @25C", "uS/cm @25C", 
"uS/cm @25C", "uS/cm @25C"), swqs = c("FW2-NT", "FW2-NT", "FW2-NT", 
"FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT", "FW2-NT"
), WMA = c(5L, 5L, 5L, 5L, 5L, 13L, 5L, 13L, 5L, 13L), year = c(2012L, 
2012L, 2012L, 2012L, 2012L, 2008L, 2012L, 2008L, 2007L, 2008L
), locid2 = c("NJW04459-254-1", "NJW04459-254-1", "NJW04459-254-1", 
"NJW04459-254-1", "NJW04459-254-1", "INTAKE", "NJW04459-254-2", 
"INTAKE", "01378600", "INTAKE")), .Names = c("orgid", "locid", 
"stdate", "sttime", "charnam", "val", "valunit", "swqs", "WMA", 
"year", "locid2"), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame"))

library(shiny)
library(shinydashboard)

header<- dashboardHeader()
sidebar<- dashboardSidebar()
body<- dashboardBody(DT::dataTableOutput("Table1"))

ui<-dashboardPage(header, sidebar, body)

server<- function(input,output,session){
  output$Table1<- DT::renderDataTable({
    DT::datatable(roadsalt_data,filter = 'top', options = list(scrollX = TRUE))
  })
}

shinyApp(ui = ui, server = server)
...