shiny dashboard: detect toggle sidebar event

When I hide the dashboard sidebar, I need to call "redraw" on my igvShiny widget. As written, igv.js does not detect css class changes, so it does not resize itself automatically to take advantage of the new space created.

I have searched up and down, consulted the shinyjs docs, but nowhere have I found a way to detect the button click, or the changed width of the sidebar.

Any suggestions on how to programmatically detect the collapse icon click, or the resizing of the sidebar?

You can use input$sidebarCollapsed which is TRUE when hidden and FALSE when expanded, as per the shinydashboard docs.

1 Like

Hi Paul,

Thanks for the reply. Yes, indeed - just as you say - the current state is available in input$sidebarCollapsed. And the event can be detected like this:

   state <- input$sidebarCollapsed

Seems so obvious now. Thank you!

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