Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select number of rows to preview in rhandsontable

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?

like image 382
Adamek Avatar asked Nov 18 '25 09:11

Adamek


1 Answers

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

like image 87
Deena Avatar answered Nov 20 '25 21:11

Deena