isolate the variable

Hi,
You will fin hereafter an extract of my app.

I use isolate() for input$prio_rows_selected but I have to reload my application to initiate the value.
I would like to know if it is possible to reset my variable without exiting my application?
Thanks in advance to your reply!
My code is based on GitHub - jienagu/DT-Editor: This is a DT Editor Shiny app

val.ecr<-reactive({
            selected_row_ecr<-0
            selected_row_ecr=isolate(input$prio_rows_selected)
            old_row_ecr=tab.ecr.prio[selected_row_ecr]
            tab.val.ecr<-old_row_ecr
            as.data.frame(tab.val.ecr)
            tab.val.ecr
            #ligne<-saveRDS(tab.val.ecr,"ligne.rds")
  })
    
  output$card<- renderText({
    val<-val.ecr()
    prettyNum(paste0(val[1,1],big.mark=","))
  })

I don't know if my issue it's clear!
Have you an idea?
Thanks!

Is there any reason to put it into an isolate() ?
I mean, yes when it is in isolate it doesn't react anymore to changes in the input$rows_selected. Probably it doesn't react at all as the rows_selected isn't initialised in the beginning.

Have you tried without using isolate?
When you want to use an isolate you may better trigger the evaluation based on a reactive button, so it's updated whenever you hit the button, but not when changing the values before.

Hi,

When you want to use an isolate you may better trigger the evaluation based on a reactive button

I followed your advise and I added enventReactive so the output$card is updated at each button click

val.ecr<-eventReactive(input$prio_rows_selected,{
           
            selected_row_ecr=input$prio_rows_selected
            old_row_ecr=tab.ecr.prio[selected_row_ecr]
            tab.val.ecr<-old_row_ecr
            as.data.frame(tab.val.ecr)
            tab.val.ecr
            })
  
  output$card<- renderText({
    val<-val.ecr()
    prettyNum(paste0(val[1,1]))
  }) 

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.