我有一个关于闪亮应用程序中的actionButon()函数的问题。 在RStudio Shiny网站中,解释了actionButton包含一些将数字发送到服务器的JavaScript代码。 当Web浏览器第一次连接时,它会发送一个值0,并且每次点击时它会发送一个递增的值:1,2,3等等。 如何知道用户何时点击按钮而不使用按钮的值?
谢谢
I have a question concerning the actionButon() function in shiny application. In the RStudio Shiny Web site, it is explained that the actionButton includes some JavaScript code that sends numbers to the server. When the web browser first connects, it sends a value of 0, and on each click, it sends an incremented value: 1, 2, 3, and so on. How is possible to know when the users clicks on the button without using the value of the button?
Thanks
最满意答案
shinyjs软件包通过onclick和onevent内置的功能可以调整您的需求。 以下示例来自https://github.com/daattali/shinyjs/issues/33
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useShinyjs(), # Set up shinyjs actionButton("date", "date"), actionButton("coords", "coords"), actionButton("disappear", "disappear"), actionButton("text", "text") ), server = function(input, output) { onclick("date", alert(date())) onclick("coords", function(event) { alert(event) }) onevent("mouseenter", "disappear", hide("text")) onevent("mouseleave", "disappear", show("text")) } ) }shinyjs package has this functionality via onclick and onevent built in so you can tailor yo your needs. Example below is taken from https://github.com/daattali/shinyjs/issues/33
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useShinyjs(), # Set up shinyjs actionButton("date", "date"), actionButton("coords", "coords"), actionButton("disappear", "disappear"), actionButton("text", "text") ), server = function(input, output) { onclick("date", alert(date())) onclick("coords", function(event) { alert(event) }) onevent("mouseenter", "disappear", hide("text")) onevent("mouseleave", "disappear", show("text")) } ) }更多推荐
actionButon,sends,发送,value,电脑培训,计算机培训,IT培训"/> <meta name="de
发布评论