ShinySky

Published by onesixx on

https://github.com/AnalytixWare/ShinySky

Handsontable Input/Output

https://code.i-harness.com/en/q/1d4f505

#rm(list = ls())
library(shiny)
library(shinysky)

ui <- basicPage(
    mainPanel(
        column(6, hotable("hotable1")),
        column(6, DT::dataTableOutput('tbl'))
    )
)

server <- function(input, output, session){
    # Initiate your table
    previous <- reactive({head(mtcars)})
    
    Trigger_orders <- reactive({
        if(is.null(input$hotable1)){
            return(previous())
        }else if(!identical(previous(), input$hotable1)){
            # hot.to.df function will convert your updated table into the dataframe
            as.data.frame( hot.to.df(input$hotable1) )
        }
    })
    output$hotable1 <- renderHotable({Trigger_orders()}, readOnly = F)
    
    # You can see the changes you made
    output$tbl = DT::renderDataTable(Trigger_orders())
}

shinyApp(ui, server)

 

 

 

 

Categories: Shiny

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.