Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rhandsontable drop-down menus cut short in Shiny app

When I try to edit the entries of an rhandsontable inside a Shiny app, the drop-down menus are cut short. Is there a way to make them fully expand like the date selectors in the rhandsontable tutorial? Here is the app.

library(rhandsontable)
library(shiny)

ui = fluidPage(rHandsontableOutput("data"))

server = function(input,output) {
  df = data.frame(x = factor(letters[1:3], levels = letters))
  values = reactiveValues(data = df)

  observe({
    req(input$data)
    values$data = hot_to_r(input$data)
  })

  output$data = renderRHandsontable({
    rhandsontable(values$data) 
  })
}
shinyApp(ui = ui, server = server)
like image 658
landau Avatar asked Jan 13 '17 21:01

landau


1 Answers

It will work if you change the size of your rhandsontable.

You could try:

library(rhandsontable)
library(shiny)

ui = fluidPage(rHandsontableOutput("data"))

server = function(input,output) {
  df = data.frame(x = factor(letters[1:3], levels = letters))
  values = reactiveValues(data = df)

  observe({
    req(input$data)
    values$data = hot_to_r(input$data)
  })

  output$data = renderRHandsontable({
    rhandsontable(values$data, height=500) 
  })
}
shinyApp(ui = ui, server = server)

EDIT: Based on this, you can use overflow = "visible". It seems to fix the issue.

ui = fluidPage(rHandsontableOutput("data"))

server = function(input,output) {
  df = data.frame(x = factor(letters[1:3], levels = letters))
  values = reactiveValues(data = df)

  observe({
    req(input$data)
    values$data = hot_to_r(input$data)
  })

  output$data = renderRHandsontable({
    rhandsontable(values$data, overflow = "visible") 
  })
}
shinyApp(ui = ui, server = server)
like image 82
MLavoie Avatar answered Oct 13 '22 20:10

MLavoie