bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

Is any way to update controlbar pinned?

Open chikao0817 opened this issue 3 years ago • 4 comments

Hi David,

Thanks for this wonderful Shiny UI package,

I tried to use shinyjs::click('controlbarPin') ,or shinyjs::runjs("document.getElementById('controlbarPin').click()") and some methods to update controlbar pinned in some conditions.

But shinyjs click only work on dashboardBody button. Is any functions or advices for updating the controlbar pinned?

Thanks you a lot!

chikao0817 avatar Oct 12 '21 09:10 chikao0817

Hey, if you're using dashboardControlbar(), there's a parameter named pinned which you can pass a boolean argument to. Pass TRUE and the controlbar will stay pinned unless the user unpins it manually.

FreyGeospatial avatar Oct 12 '21 16:10 FreyGeospatial

Hi,

Thanks for reply :) Sorry I wasn't cleanly asked my question.

I had set dashboardControlbar() parameter pinned = TRUE, and overlay = TRUE in app beginning. but I need when user in some condition (like during cicerone tour guide, I want pinned but when end the guide, I wish it can automatically click controlbarPin to swtich status for pinned = FALSE ).

so maybe it will has some function can update pinned like updateControlbar() to use in observeEvent()... I tried using shinyjs::click() but didn't work.

Thank you so much for responding 👍

chikao0817 avatar Oct 13 '21 01:10 chikao0817

I find a method to treat this state.

Only use shinyjs::extendShinyjs to create function

ui

useShinyjs(),
shinyjs::extendShinyjs(text = "shinyjs.clickpin = function(){$('#controlbarPin').click()}",functions = c("clickpin"))

server js$clickpin()

and it will be work.

chikao0817 avatar Oct 13 '21 06:10 chikao0817

Ok. This is good idea for the next release.

DivadNojnarg avatar Nov 14 '21 16:11 DivadNojnarg