0

I've put an actionButton but I'd like to put a selectImput with three options.

With each change of option I would like you to show in the Time column the time between option 2 and option 3.

At the moment I can not put the information in the column and the time is being counted in the total not individually in each row.

 ui <- fluidPage(
 navbarPage(
 mainPanel(
  # dataTableOutput('tabela')
  DT::dataTableOutput("data"),
  textOutput('myText'),
  actionButton("At", "Click Me")
)))

server <-function(input, output, session) {
myValue <- reactiveValues(Action = '')

shinyInput <- function(FUN, len, id, ...) {
inputs <- character(len)
for (i in seq_len(len)) {
  inputs[i] <- as.character(FUN(paste0(id, i), ...))
}
inputs
}

seriet<-reactiveValues(data = data.frame(
Name = c('Laurena', 'Jennifer', 'Augusto', 'Henrique', 'Zeina','Jaque'),
Grade = c(1, 2, 3, 2, 1, 3),
Time=c(0,0,0,0,0,0),
Sport=c("Nado", "Corrida","Nado", "Corrida","Nado", "Corrida"),
Actions = shinyInput(actionButton, 6, 'button_', label = "At", onclick = 
'Shiny.onInputChange(\"select_button\",  this.id)' ),
stringsAsFactors = FALSE,
row.names = 1:6#prestar atencao
))

 output$data <- DT::renderDataTable(  
seriet$data,escape = FALSE
)

observeEvent(input$select_button, {
  click <- timer()
myValue$Action <<- paste('Tempo',{print(click())*60})
 })

output$myText <- renderText({
myValue$Action
})

click <- timer()
observeEvent(input$At, {print(click())})

}
shinyApp(ui, server)
  • Please see [How to make a Shiny app reproducible example?](https://stackoverflow.com/questions/48343080) for tips on how to create a good Shiny reproducible example. Also, it is not really clear to me what you are asking, could you please elaborate a bit? – Florian May 25 '18 at 06:31
  • Sorry, my inglish is not good. I want to count the time between the clicks in the buton( in eache row). EX. I click on the buton several times and I should have the time interval between the clicks and show this time in column Time. The problem is that I cant have the time individually, the time is counting like its just one buton. – Jaqueline Araujo May 27 '18 at 00:00

0 Answers0