2016-08-23 36 views
2

我有这个应用程序正在4Gb RAM Shiny服务器上工作,但我也上传到shinyapps.io(这是限于1GB内存)。问题在于其中一个选项卡总是会导致应用程序崩溃。事实上,这个标签需要超过1Gb的RAM才能运行。所以我想知道是否有办法让应用程序喜欢它,并且所有选项卡对于用户都是可见的(所以他知道应用程序可以对一个好的服务器执行什么操作)。但也使其中一个标签无法访问。我的意思是用户可以浏览所有选项卡,除非他在特定的崩溃选项卡上进行搜索时,会出现一些没有用户弹出的入口标志。所以他不能点击这个标签,但他仍然看到它。制作一个标签可见,但无法在R闪亮的应用程序

Thx,我认为这是不可能的,但我们永远不知道!也许用一些Javascript或CSS!

像这样的东西与我的所有标签:

enter image description here

回答

0

有点技巧,但工作示例

想法

1)添加ID的所有选项卡和HREF中(为它创建功能)

2)禁用它

上actionbutton

禁用选项卡表(我不知道你是怎么wnat估计“好服务器”选项卡,从而禁止manualy)

library(shiny) 
library(shinyjs) 


server<-shinyServer(function(input, output) { 
    observeEvent(input$disable,{ 
    disable("Table") 
    disable("Table_") 
    }) 

}) 
add_id=function(ss){ 

    ss$children[[1]]$children=lapply(ss$children[[1]]$children,function(i){ 
    i$attribs=list(id=i$children[[1]]$attribs["data-value"][[1]]) 
    i$children[[1]]$attribs=c(i$children[[1]]$attribs,id=paste0(i$children[[1]]$attribs["data-value"][[1]],"_")) 
    return(i) 
    }) 
    return(ss) 
} 


ui<-shinyUI(fluidPage(
    useShinyjs(), 
    actionButton("disable","disable"), 
    add_id(tabsetPanel(
     tabPanel("Plot", h1("1")), 
     tabPanel("Summary", h1("2")), 
     tabPanel("Table", h1("3")) 
    )) 

)) 
runApp(list(ui=ui,server=server)) 
相关问题