Sté*_*ent 2 jquery r twitter-bootstrap shiny
下面的最小闪亮应用程序生成一个带弹出窗口的html表.它在闪亮的0.8下运行良好,但它不适用于闪亮的0.9:只显示弹出窗口的标题,而不是内容.这个问题在发光讨论中尚未解决.也许是由于bootstrap或jQuery,它们已经在闪亮的0.9中更新了
tabl <- function(){
title <- "hello"
content <- "Goodbye"
out <- sprintf('<table style="width:300px">
<tr>
<td><a href="javascript: void(0)" data-toggle="popover" data-content="%s" data-html="true" data-animation="true" data-placement="bottom" data-trigger="hover" title="%s">Jill</a></td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
', title, content)
out <- tagList(
singleton(
tags$head(
tags$script("$(function() { $(\"[data-toggle='popover']\").popover(); })")
)
),
HTML(out)
)
return(out)
}
runApp(
list(
ui=pageWithSidebar(
headerPanel(""),
sidebarPanel(
),
mainPanel(
uiOutput("htmltable")
)
),
server=function(input,output,session){
output$htmltable <- renderUI({ tabl() })
})
)
Run Code Online (Sandbox Code Playgroud)
这是一个时间问题:将你的功能改为
tags$script("$(setTimeout(function() { $(\"[data-toggle='popover']\").popover(); }),3000)")
Run Code Online (Sandbox Code Playgroud)
例如,它应该工作.元素在原始版本的DOM中不存在.以上是解决问题的廉价(不一定是好的)方法.
闪亮的变化为0.9
与和一起使用时,制作
tags$head()和singleton()行为正确.以前,"将内容提升到头部"和"仅渲染项目一次"是仅在页面最初加载时才起作用的功能,而不是在动态渲染中.
renderUI()uiOutput()
大概以前剧本并没有被提升到头部,执行顺序也不同.
| 归档时间: |
|
| 查看次数: |
472 次 |
| 最近记录: |