Comments (7)
Thank you for the feedback. That's interesting. It looks like its a timing issue. bsTooltip
is firing before shiny has had the chance to render the button. shinyBS waits 100ms to give shiny a chance to load everything but apparently that isn't enough time in this case. When you remove the collapses, shiny renders the button sooner and its there when bsTooltip
fires. I increased the delay from 100ms to 500ms and that seems to be enough time to render the button with or without the collapses.
I think the better way to handle this may be to include bsTooltip
as part of renderUI
so in your server script you would have something like this:
output$tooltip_test <- renderUI({
tagList(
actionButton("test", "Test"),
bsTooltip("test", title = "Test", placement="right")
)
})
I tested that and it seems to work in your example. Let me know if it fixes the real problem you are having. Regardless, there should be a more intuitive way to add tooltips and popovers to rendered elements. I will see what I can do.
Thanks,
Eric
from shinybs.
Thanks! The increase from 100ms to 500ms definitely seems to help.
from shinybs.
I just added a new function tipify
so you can wrap any other shiny element in tipify
and it will create a tooltip on the wrapped element. I think this is a better solution than hoping that the timing works out right. So instead of bsTooltip
in your UI, your server would look like this:
output$tooltip_test <- renderUI({
tipify(actionButton("test", "Test"), title = "Test", placement = "right")
})
If you can, try it and see if it works for you. I think this would be a safer method for adding tooltips to elements created with renderUI.
from shinybs.
Cool. That seems like a good idea. It does work for me in the toy example, but I can't get it to work in my actual shiny app. Here's the relevant code from my server and ui files:
In server.R
output$ui_multiview_customize <- renderUI({
bsCollapse(
bsCollapsePanel(title = "View Options",
checkboxInput("multiview_checkbox", label = "Include warmup", value = FALSE),
hr(),
tipify(downloadButton("download_multiview", "Save as ggplot2 objects"),
title = "Save ggplot2 object in .RData file.", placement="right")
)
)
})
and then in ui.R I have
tabPanel("Multiview",
uiOutput("ui_multiview_customize"),
plotOutput("multiview_plot")
)
Everything works fine except the tooltip doesn't show up.
from shinybs.
I created this example to try to replicate your situation:
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
tabsetPanel(
tabPanel("Tab #1",
plotOutput("genericPlot")
),
tabPanel("Tab #2",
uiOutput("ui_multiview_customize"),
plotOutput("multiview_plot")
)
)
),
server =
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(1000)))
output$multiview_plot <- renderPlot(plot(runif(1000)))
output$ui_multiview_customize <- renderUI({
bsCollapse(
bsCollapsePanel(title = "View Options",
checkboxInput("multiview_checkbox", label = "Include warmup", value = FALSE),
hr(),
tipify(downloadButton("download_multiview", "Save as ggplot2 objects"),
title = "Save ggplot2 object in .RData file.", placement="right")
)
)
})
}
)
And tipify
works for me in this example. Am I missing something?
from shinybs.
Hmmm, tipify
works for me too in this example, so I don't think you're missing anything.
It just doesn't work when this example is placed in the larger context of my app. There must be something else going on in my app that prevents it from working, but I'm not sure what it would be.
from shinybs.
aha, do these delay issues affect bsCollapse as well? I have an app in which the panels keep closing as soon as they have fully opened, I think because the app is taking rather long render its stuff. If so, is there an easy way to tweak the delay, I can't find it in the code.
from shinybs.
Related Issues (20)
- FR: Allow for adding popovers/tootips to arbitrary elements
- Info button refreshing the page when clicked on
- bsTooltip not working (i.e. no hover tooltip shown) when referencing ID of UI module HOT 1
- Fast clicks can cause issues with bsModal
- Jquery error Uncaught Error: Syntax error, unrecognized expression: # HOT 2
- Mt app is frozen when close two opened modals
- FR: Allow updating additional attributes in `updatePanel`
- FR: Allow specification of id tag in bsCollapsePanel
- FR: Add 'multiple' parameter to `collapseUpdate`
- Uncaught referenceErrorL ShinyBS is not defined at ..... HOT 4
- Soft wrap long text in bsCollapsePanel()
- Is someone taking over support of this package?
- Change the way shinyBS adds resource path HOT 1
- modal is not working in ioslides_presentation
- Tooltips does not show up with shinyDashboard boxes sidebar
- bsModal works with shinydashboard but not when tabItems / tabItem are utilized HOT 2
- Dependencies failed to load HOT 1
- Alternatives to shinyBS HOT 1
- bsPopover (tooltip) not working in shinyapps.io
- feature request, load function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shinybs.