2016-07-31 5 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

関連する問題