2016-07-31 6 views
1

원본 데이터 세트가 매우 커서 홍채 데이터 세트를 사용하여 문제를 재현했습니다. 꽃 설명이 담긴 'new_var'열을 추가했습니다. 내가 가진 문제는 드롭 다운 메뉴에서 여러 입력 (> 3)을 선택하면 드롭 다운 메뉴에서 나머지 값을 표시하도록 세로 막대 길이가 조정되지 않습니다.빛나는 대시 보드 사이드 바 길이를 늘리십시오.

사이드 바 길이를 늘려 보았지만 작동하지 않습니다. fluidPage로 대시 보드 사이드 바를 감싸려고했는데 작동하지 않습니다.

사이드 바의 길이를 동적으로 조정하여 모든 값을 보거나 세로 스크롤 막대를 제공하도록 스크롤 할 수 있다면 정말 찾고 있습니다. 감사합니다

library(datasets) 
library(shiny) 
library(shinydashboard) 
library(DT) 

data(iris) 
x <- c("Small flowers","Flowers (or heads) borne singly on isolated stems or arising individually from leaf axils. Not part of a larger group.", "A simple, indeterminate inflorescence consisting of stalked flowers attached to a central stem and forming a more or less elongated cluster. The stalk of a flower is termed a pedicle and pedicled flowers are implied by the term raceme when used alone in the specific sense. ", "An indeterminate inflorescence consisting of stalkless flowers attached to a central stem, generally forming a highly elongated cluster. A raceme of stalkless flowers. ", "An indeterminate inflorescence forming a convex or flat-topped cluster, essentially a contracted raceme. Typically flowers arise from a central axis on stalks (pedicles) of different lengths that bring them all to near the same height. The term is also applied to racemes of similar shape with branching pedicles. The outermost flowers generally open first. ") 
iris$new_var <- rep(x, each = 30) 


ui <- 
    dashboardPage(
    dashboardHeader(title = strong("DATA LOADER"),titleWidth = 240), 
    dashboardSidebar(

     sidebarMenu(
     selectizeInput("newvar", "Choose type of flower:", choices = sort(unique(iris$new_var)), multiple = TRUE) 

    ) 
    ), 
    dashboardBody(
     fluidRow(
     dataTableOutput("df"), 
     br() 
    ))) 

server <- function(input, output){ 
    output$df <- renderDataTable(reactive({ 
    iris[iris$new_var %in% input$newvar, ] 
    })()) 
} 
shinyApp(ui, server) 

답변

3

사이드 바의 아래쪽으로 겹치는 부분을 보이지 않게 유지하는 CSS 스타일 정의가 있습니다. 페이지를 스크롤 할 수 있도록하려면 해당 정의를 재정의해야합니다.

모든 대시 보드 요소의 "래퍼"는 overflow: hidden !important이며 웹 페이지보다 실제 대시 보드처럼 보이게합니다. 이상하게도, dashboardBody은 스크롤 할 수 있기 때문에 이것은 사이드 바의 가시성에만 영향을 미칩니다.

head 태그 안에 스타일 정의를 작성했습니다. 이렇게하면 HTML 머리에 추가 될 것이므로이 정의가 어디에 배치되는지는 중요하지 않습니다.

문제가 해결되지 않으면 의견을 보내주십시오. 아래

코드 : 많은

library(datasets) 
library(shiny) 
library(shinydashboard) 
library(DT) 

data(iris) 
x <- c("Small flowers", "Flowers (or heads) borne singly on isolated stems or arising individually from leaf axils. Not part of a larger group.", "A simple, indeterminate inflorescence consisting of stalked flowers attached to a central stem and forming a more or less elongated cluster. The stalk of a flower is termed a pedicle and pedicled flowers are implied by the term raceme when used alone in the specific sense. ", "An indeterminate inflorescence consisting of stalkless flowers attached to a central stem, generally forming a highly elongated cluster. A raceme of stalkless flowers. ", "An indeterminate inflorescence forming a convex or flat-topped cluster, essentially a contracted raceme. Typically flowers arise from a central axis on stalks (pedicles) of different lengths that bring them all to near the same height. The term is also applied to racemes of similar shape with branching pedicles. The outermost flowers generally open first. ") 
iris$new_var <- rep(x, each = 30) 

ui <- 
    dashboardPage(
    dashboardHeader(title = strong("DATA LOADER"),titleWidth = 240), 
    dashboardSidebar(
     tags$head(tags$style(".wrapper {overflow: visible !important;}")), 
     sidebarMenu(
     selectizeInput("newvar", "Choose type of flower:", choices = sort(unique(iris$new_var)), multiple = TRUE) 

    ) 
    ), 
    dashboardBody(
     fluidRow(
     dataTableOutput("df"), 
     br() 
    ))) 

server <- function(input, output){ 
    output$df <- renderDataTable(reactive({ 
    iris[iris$new_var %in% input$newvar, ] 
    })()) 
} 
shinyApp(ui, server) 
+0

감사합니다 ... 내 문제를 해결 – user1946217