简体   繁体   中英

R: Hover Event in Shiny App

I have a datatable within a Shiny app containing thousands of records and 10 fields. One of the fields, 'Notes', contains the body of a unique email sent to each record. Due to the size of some of the emails, it takes up a lot of room in the datatable. I would like to create an info icon for each row that when hovered over will display the email associated with that row in a popup window which will subsequently go away after moving the mouse off of the icon. Is this possible in Shiny?

Yes. First, you'll need to process that email text as HTML and add the following tags:

<i class='fa fa-info-circle' data-toggle='tooltip' data-placement='right' title='YOUR EMAIL TEXT'></i>

Depending on the size of your email, that tooltip might become a bit heavy, but this does what you want it to do.

Note that this is assuming you're running shinyDashboard (although I think any of the options - fluidPage, navbarPage etc - will work).

You also need to set escape = FALSE in datatable(x, escape = FALSE)

You can have a look at this implementation. For a table demo, click on GO , then click on the 'Health Behaviors' tab.

http://healthpolicy.ucla.edu/health-profiles/adults/Pages/dashboard.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM