0

I have a random word listI want the list to be updated by clicking the "aleatorizar" button.I tried placing the renderprint of the list inside the observerEvent of the click "aleatorizar", but it didn't work.What can I do?

example image below

sample image

server = function(input,output) {
 datatonincanon = reactiveValues(data= NULL)
  
  output$filtrocheck = DT::renderDataTable({
    
    datatonincanon$data = filter(databanco, (databanco$Tonicidade %in% (input$IdTonin) & databanco$Canonicidade %in% (input$IdCanon)))
    DT::datatable(datatonincanon$data[,c(-4,-5,-8,-9,-10,-11,-12,-13)],options = list(searching=TRUE),rownames= FALSE)
    
    })
  
  observeEvent ("IdGerar", {
    
               output$Lista = renderPrint({
                 
                 printf= function(...){
                   invisible(cat(sprintf(...)))
                 }
                 req(datatonincanon$data)
                 data = datatonincanon$data
      printf(as.character(list(sample(data$Palavra, 30))))
           })
               })
starja
  • 9,887
  • 1
  • 13
  • 28
  • 1
    Please provide proper tags for your question (e.g. NodeJS, Java, etc...). – Adel Rustum Aug 24 '20 at 15:19
  • Please change `"IdGerar"` to `input$IdGerar` in the `observeEvent` – YBS Aug 24 '20 at 16:08
  • Please provide a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), so here provide the UI and all packages you use. I think you could use the pattern with a [`eventReactive`](https://mastering-shiny.org/basic-reactivity.html#controlling-timing-of-evaluation) that returns the data (and it is reactive on the button click), and then use this reactive object in a `renderPrint` – starja Aug 24 '20 at 16:10

0 Answers0