我還沒有發現在shinyBS
文檔和谷歌的/任何信息,以便了解如何上使用trigger = 'manual'
,例如,shinyBS
addPopover
。我認爲這將是向禁用按鈕添加工具提示的方式。 (我不想用div
「詠按鈕,並給予title
到div
做到這一點。 也將是不錯,如果有人有辦法被動添加工具提示shiny
應用添加shinyBS酥料餅上禁用按鈕
回答
由於shosaco的解決方案沒有工作,我得到它的工作是這樣的:
if (input$disable) {
addCssClass("buttonId", "disabled")
bsTooltip("buttonId", "This button is currently disabled.")
} else {
bsTooltip("buttonId", "")
removeCssClass("buttonId", "disabled")
}
observeEvent(input$buttonId, {
if (!input$disable) {
output$text <- renderText("Bla")
} else {
output$text <- renderText(NULL)
}
如果你想在酥料餅的使用trigger = manual
,那麼你需要定義一個腳本來切換酥料餅,如使用jQuery:
library(shiny)
library(shinyjs)
library(shinyBS)
ui <-shinyUI(fluidPage(useShinyjs(),
# press this button to trigger the popover
actionButton("addPopover", "Add Popover"),
# a disabled button
disabled(actionButton("disabledButton", "This button is disabled")),
# the popover to appear over the disabled button
bsPopover("disabledButton", "Popover", "Some text", trigger="manual"),
# the script to trigger the popover
uiOutput("trigger")))
server <- shinyServer(function(input,output, session){
# on checkbox selection, disable button and trigger the popover
output$trigger <- renderUI({
input$addPopover
tags$script("$('#disabledButton').popover('toggle');")
})
})
shinyApp(ui,server)
如果你想這樣做沒有jQuery的,這將是一個解決方案:對我來說
library(shiny)
library(shinyjs)
library(shinyBS)
ui <-shinyUI(fluidPage(useShinyjs(),
# checkbox for disabling and tooltip action
checkboxInput("disable", "Disable"),
# a button
actionButton("buttonId", "Some button"),
# uiOutput to realize logic for tooltip
uiOutput("trigger")))
server <- shinyServer(function(input,output, session){
# on click of input$addPopover, trigger the popover over the disabled button
output$trigger <- renderUI({
if(input$disable) {
shinyjs::disable("buttonId")
bsTooltip("buttonId", "This button is currently disabled.")
}else{
shinyjs::enable("buttonId")
bsTooltip("buttonId", "")
}
})
})
shinyApp(ui,server)
這是一個很好的方式,謝謝。不幸的是,我在jQuery中什麼都不知道。你能給我提示我該如何做,所以當前被禁用的'actionButton'顯示懸停的彈出窗口?在我的應用程序中,我試圖做這樣的事情: 'if(condition == TRUE){shinyjs :: disable(buttonId); addTooltip(session,id ='buttonId',title = paste0('這個按鈕目前被禁用')',沒有很好的工作 –
更新我的解決方案,包括「沒有jquery」 - 解決方案......奇怪的原因' addPopover'不起作用... – shosaco
即使使用'bsTooltip'也不適用於我,即使在刪除ckeckbox後移動鼠標速度夠快,它也會顯示一個工具提示,但我沒有說我不喜歡jquery解決方案,它只是我需要彈出窗口顯示在'懸停'上,而不是按鈕單擊。但通常'懸停'不適用于禁用按鈕,這就是爲什麼我想'manial'選項 –
- 1. 引導酥料餅,。點擊裏面沒有趕上酥料餅的按鈕
- 2. 添加在UITabBar一個按鈕,觸發一個酥料餅
- 3. 按鈕不是引導酥料餅
- 4. 按鈕在簡單酥料餅
- 5. 引導酥料餅,關閉按鈕
- 6. 上點擊隱藏引導酥料餅外酥料餅
- 7. 在酥料餅
- 8. Fullcalendar酥料餅
- 9. 如何將按鈕添加到iPad應用程序的酥料餅的觀點
- 10. AngularStrap皮酥料餅
- 11. 酥料餅與MeteorJS
- 12. 引導酥料餅
- 13. 如何酥料餅
- 14. 引導酥料餅
- 15. 酥料餅和Tableviews
- 16. 自舉酥料餅
- 17. 引導酥料餅裏面酥料餅不工作
- 18. $(「一[相對=酥料餅]」)。酥料餅不是一個函數
- 19. 酥料餅的按鈕onclick事件不起作用
- 20. 加載HTML文件中,以酥料餅
- 21. 無法處理酥料餅
- 22. 圖像拾取酥料餅
- 23. 的iPad:在酥料餅
- 24. 酥料餅框架問題
- 25. 引導酥料餅不imagepicker.js
- 26. 引導酥料餅/ Clickover
- 27. 引導3酥料餅
- 28. 酥料餅通過AJAX
- 29. 酥料餅的的MPMoviePlayerController
- 30. 引導酥料餅與Simple_Form
請你提供一個可重複的例子。我相信我可以給你一隻手 –
@PorkChop 這個問題有一個答案,有足夠的例子。 Sry我無法回答。我試圖做的事情是在'disabled'按鈕上添加彈出窗口,該按鈕顯示在用鼠標懸停的按鈕上,並在按鈕激活時將其刪除。 –