Is there a way to trigger an event when DT table has finished drawing?

15 views
Skip to first unread message

Timothy Adams

unread,
Jun 29, 2016, 10:34:56 AM6/29/16
to Shiny - Web Framework for R
I have a ggplot2 heatmap that I've connected to a DT (the heatmap displays data depending on what row is selected in the DT). This DT, in turn, automatically filters itself as the user interacts with a different figure (parallel coordinates plot). This has resulted in some strange behavior:
  1. The user will filter with the parallel coordinates plot.
  2. This will trigger the DT to filter. During this time, it reads "processing". (This is fine)
  3. While the DT is processing, the heatmap will change ~3-5 times.
  4. Eventually, the DT will finish processing and the heatmap will "settle" to display whatever row is selected.
I would like to prevent (3), as it's slowing the app down (it increases the amount of the time the DT processes). My preferred way to do this is to only update the heatmap once the data table has finished processing. I think the draw event is what I'm looking for, but I'm not sure how to use this in Shiny. Does anyone have any ideas or code examples?

Many thanks!

Also, FWIW, this is the code I'm using to render my data table:
  output$decision_space <- DT::renderDataTable(
     
select(obj_space_selected(),cost,K,prio,alpha,beta),
      options
= list(pageLength = 5),
      selection
= list(mode = 'single', selected = c(1))
 
)


Reply all
Reply to author
Forward
0 new messages