搜索
查看: 1727|回复: 0

用shinyBS实现弹窗全选警告功能

[复制链接]

634

主题

1182

帖子

4030

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
4030
发表于 2017-3-29 11:33:29 | 显示全部楼层 |阅读模式
非常赞,其实全选checkbox重点是设置choice变量。
但是shinyBS给了bsModal功能,可以当做弹窗的一种~

[AppleScript] 纯文本查看 复制代码
library(shiny)
library(shinyBS)

campaigns_list <- letters[1:10]

ui =fluidPage(
  checkboxGroupInput("campaigns","Choose campaign(s):",campaigns_list),
  actionLink("selectall","Select All"),
  bsModal("modalExample", "Yes/No", "selectall", size = "small",wellPanel(
    actionButton("no_button", "Yes"),
    actionButton("yes_button", "No")
  ))
)
server = function(input, output, session) {
  
  observe({
    if(input$selectall == 0) return(NULL) 
    else if (input$selectall%%2 == 0)
    {
      updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list)      
    }
    else
    {
      updateCheckboxGroupInput(session,"campaigns","Choose campaign(s):",choices=campaigns_list,selected=campaigns_list)
    }
  })
  
  
}
runApp(list(ui = ui, server = server))
你这个问题很复杂,需要打赏,请点击 http://www.bio-info-trainee.com/donate 进行打赏,谢谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树 ( 粤ICP备15016384号  

GMT+8, 2019-8-23 07:26 , Processed in 0.031926 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.