ubuntu - SelectizeGroupUI - 部署 AWS 时无法设置过滤器宽度,INLINE = TRUE 错误

标签 ubuntu shiny width selectize.js shinywidgets

在我 Shiny 的应用程序中,我使用 selectizeGroupUI 作为我的依赖选择输入的一部分。我正在努力手动将过滤器的宽度设置为比它们的标题更宽。请参阅下面的屏幕截图。强烈赞赏建议。
screenshot of the UI rendering with filter width default to title length
第二个问题是,在 AWS ubuntu 上部署时,INLINE = TRUE 并不适用于所有选择输入。请参阅下面的屏幕截图。 Ubuntu 正在运行 shinyWidgets 0.6.3、 Shiny 1.7.1。
screenshot of deployed app with one of the filters errored as horizonal when INLINE = TRUE

OYCF_PDE_Entities <- dbGetQuery(con,
                     "SELECT * FROM oycf_pde_entities")
geocodes_penn_counties <- dbGetQuery(con,
                                     "SELECT * FROM geocodes_penn_counties")

#Define the UI
ui <- fluidPage(
  tags$head(
    tags$style(HTML("hr {border-top: 1px solid #1D5C91;}"))
  ),
  theme = bs_theme(version = 5, bootswatch = "materia"),
  titlePanel(img(src = "PDE.jpg",height=150, width= 150)),
  
  sidebarLayout(
    sidebarPanel(
      h4(strong("Query the PDE/OCYF Database")),
      h5(strong("Purpose")),
      p("This application is designed for performing custom queries to a database containing information about private and non-public 
      entities who are serving school-aged children and youth in the Commonwealth of Pennsylvania. Sites in this database include private or non-public licensed schools, as well 
        as non-public entities such as residential and juvenile justice institutions."),
      p(strong("How to Search")),
      tags$ol(
        tags$li("The database provides information at the site-level, as well as by several higher-order aggregates, including region, county, city, type of service, PDE Educational Entity and DHS Entity."),
        tags$li("Use the drop-down filters within this menu to perform a custom query that automatically displays in the table. Selecting one or more values fromm the filters will automatically remove irrelevant values from the rest of the filters. You can also use the filters in any order. They will still show only relevant options."),
        tags$li("The search function at the top right of the table accepts words and/or whole numbers. The search function looks across all columns for all entities in the database and displays every entity with a column containing the number and/or word that was typed."),
        tags$li("Use the first drop down box to select multiple fields from the database. Your choices will be displayed automatically in the table. The application defaults to showing several key fields. Use backspace")
        ),
      selectInput(
        "vars",
        strong("Select Fields"),
        names(OYCF_PDE_Entities),
        selected = c("DHS_ENTITY_NAME","CITY","COUNTY","REGION","ADMINISTRATIVE_UNIT_AUN"),
        selectize = TRUE,
        multiple=TRUE),
      selectizeGroupUI( 
        id="my_filters",
        inline= TRUE,
        params = list(
          REGION = list(inputId="REGION",title="Select Region",placeholder='select'), 
          COUNTY = list(inputId="COUNTY",title="Select County",placeholder='select'),
          CITY = list(inputId="CITY",title="Select City",placeholder='select'),
          DHS_TYPE_OF_SERVICE = list(inputId="DHS_TYPE_OF_SERVICE",title="Select Type of Service",placeholder='select'),
          PDE_EDUCATIONAL_ENTITY = list(inputId="PDE_EDUCATIONAL_ENTITY",title="Select PDE Educational Entity",placeholder='select'),
          DHS_ENTITY_NAME = list(inputId="DHS_ENTITY_NAME",title="Select DHS Entity",placeholder='select')
          ),
        btn_label="Reset All Filters"
        ),
      p("For technical support, please contact Mflanagan@pattan.net",
        style = "font-family:'arial';font-size:11pt;color:#1D5C91",align = "center")
    ),
    mainPanel(
      tabsetPanel(
        tabPanel("Database",
                 br(),
                 DT::dataTableOutput("MainTable")),
        tabPanel("Map of Entities in Database",
                 br(),
                 plotOutput("entitymap", height="900px",width="1000px")
                 )

    ))
  )
)

server <- function(input,output,session){
#create reactive environment for database
  rv <- reactiveValues(alldata=data.frame(OYCF_PDE_Entities))
  
#set up the table's server module
DHSTable <- callModule(
  module = selectizeGroupServer,
  id = "my_filters",
  data = rv$alldata,
  vars = c("REGION","COUNTY","CITY","DHS_TYPE_OF_SERVICE","PDE_EDUCATIONAL_ENTITY","DHS_ENTITY_NAME")
)

#output the filtered data to data table UI
  output$MainTable <- DT::renderDataTable({
    DHSTable() %>% select(all_of(input$vars))
  })

#output map of entities across the state of PA
  
output$entitymap <- renderPlot({
  ggplot() +
    geom_polygon(
      mapping = aes(lon,lat,group = group),
      data = geocodes_penn_counties,
      fill="#1D5C91",colour = "deepskyblue3") +
    geom_point(data = DHSTable(), mapping = aes(x = lon, y = lat),colour ="cyan1",size = 1.5) +
    theme_bw() + 
    theme(panel.border = element_blank(), 
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          axis.line = element_blank(),
          axis.ticks = element_blank(),
          axis.title = element_blank(),
          axis.text = element_blank()) +
    coord_quickmap()
  })
  
#Query Results - When filters are changed, update the count from the table even if looking at the map (table not loaded)
  
#reactive expression
  records_reactive <- eventReactive(
    input$MainTable_rows_all,{
      NROW(input$MainTable_rows_all)
    }
  )

  #output record count
  output$recordsreturned <- renderText(paste("Number of Records:",records_reactive()))
  
#summary, not filter dependent
output$descriptive1 <- renderText(paste("Total Number of Records in Database:",nrow(OYCF_PDE_Entities)))

}

#Run the app
shinyApp(ui = ui,server = server)

最佳答案

我想我知道问题是什么。从shinyWidgets 0.6.3 版开始,您需要重复inline callModule 中的参数-称呼。
由于 this issue,需要进行此更改.
请在以下示例的服务器部分中查看我的评论:

library(shiny)
library(shinyWidgets)

data("mpg", package = "ggplot2")

ui <- fluidPage(
  titlePanel("Hello Shiny!"),
  sidebarLayout(
    sidebarPanel(
      selectizeGroupUI(
        id = "my-filters",
        params = list(
          manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
          model = list(inputId = "model", title = "Model:"),
          trans = list(inputId = "trans", title = "Trans:"),
          class = list(inputId = "class", title = "Class:")
        ),
        inline = FALSE
      )
    ),
    mainPanel(
      DT::dataTableOutput(outputId = "table")
    )
  )
)

server <- function(input, output) {
  res_mod <- callModule(
    module = selectizeGroupServer,
    id = "my-filters",
    data = mpg,
    vars = c("manufacturer", "model", "trans", "class"),
    inline = FALSE # switch to TRUE to see the issue
  )
  output$table <- DT::renderDataTable(res_mod())
}

关于ubuntu - SelectizeGroupUI - 部署 AWS 时无法设置过滤器宽度,INLINE = TRUE 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70716955/

相关文章:

git - [ubuntu 13.04] 为什么我的 git 使用不同的 key 文件?

ubuntu - Clang 格式给出错误

css - 如何使用 Tailwind CSS 将宽度设置为超过 100%

ubuntu - 如何在 Ubuntu 上安排自动 FTP 下载?

ubuntu - Dart Ubuntu Server 14.04 如何为 Dartium 安装缺少的库

R、Leaflet多边形添加黑色边框

r - sliderTextInput 显示不正确的值?

r - Shiny 表格中的数学模式

jQuery改变输入搜索框的宽度

javascript - 是否可以使用具有统一(jquery 插件)的不同大小(宽度)的选择框?