2

When working with datatables everything is clear - I can choose 5, 10, 25, 50 or 100 entries.

shinyApp(
  ui = fluidPage(
    fluidRow(
      column(12,
             dataTableOutput('table')
      )
    )
  ),
  server = function(input, output) {
    output$table <- DT::renderDataTable(iris)
  }
)

Unfortunately, in rhandsontable I can not find proper solution. My only result looks that:

 shinyApp(
      ui = fluidPage(
        fluidRow(
      column(12,
             rHandsontableOutput('table')
      )
    )
  ),
  server = function(input, output) {
    output$table <- renderRHandsontable(
      rhandsontable(iris, width = 550, height = 300)
    )
  }
)

How can I enforce rhandsontable to give me selectinput with number of entries?

Adamek
  • 95
  • 8

1 Answers1

1

You can pass min/max rows/columns to the function: https://github.com/handsontable/handsontable/issues/225

library(shiny)
library(rhandsontable)

shinyApp(
  ui = fluidPage(
    fluidRow(
      column(12,
             sliderInput('input', label = "Rows",
                         min = 1, max = nrow(iris), value = 10)
      ),

      column(12,
             rHandsontableOutput('table')
      )
    )
  ),
  server = function(input, output) {
      output$table <- renderRHandsontable(
        rhandsontable(iris, width = 550, height = 300, maxRows = input$input)
    )
  }
)

enter image description here

Deena
  • 5,925
  • 6
  • 34
  • 40