我目前正在玩shinyTable
这是一个shiny
HandsonTable 的兼容实现(https://github.com/trestletech/shinyTable https://github.com/trestletech/shinyTable)。碰巧我意识到,如果我添加一个logical
渲染的列data.frame
这些值将显示为可单击的复选框。我的希望是使用它来轻松地对表进行子集化:
library(devtools)
# those versions are necessary to let shinyTable work with shiny
install_github( "shiny", "rstudio", ref="fcf963639e4839e5689665c257e7f488c9c34cc0" )
install_github( "shinyTable", "JackStat" )
library(shiny)
library(shinyTable)
runApp(list(
ui = bootstrapPage(
htable( "tbl", clickId="tblClick", headers="provided")
),
server = function(input, output) {
output$tbl <- renderHtable({
if( is.null( input$tbl ) ){
return( data.frame( select = TRUE, value = 1:10 ) )
} else{
return( input$tbl[ input$tbl$select, ] )
}
})
}
))
但是,当取消选中复选框时,我将得到以下结果:
有谁有经验吗shinyTable
并能给我一个如何避免这种情况的建议吗?
或者:
任何其他(对于我的用户舒服的) 方法让我创建子集表?
在这种情况下,少即是多
library(shiny)
library(shinyTable)
runApp(list(
ui = bootstrapPage(
htable( "tbl", clickId="tblClick", headers="provided", readOnly = 'false')
),
server = function(input, output) {
output$tbl <- renderHtable({
if( is.null( input$tbl ) ){
return( data.frame( select = TRUE, value = 1:10 ) )
}
})
}
))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)