在我的 server.R 我有
library (shiny)
shinyServer (function (input, output, session)
{
values <- reactiveValues() # create a reactiveValues object, to let us use settable reactive values
values$lastAction <- NULL # to start out, lastAction == NULL, meaning nothing clicked yet
# an observe block for each button, to record that the action happened
observe ({
if (input$runButton != 0) {
values$lastAction <- 'run'
}
});
observe ({
# make sure we have data
if (is.null (values$lastAction))
return (NULL);
print ("Detected button Press");
});
})
并在我的 index.html
中<html>
<head>
<title>Structural Variant (SV) Analysis</title>
<script type="text/javascript" src="shared/jquery.js"></script>
<script type="text/javascript" src="shared/shiny.js"></script>
<link rel="stylesheet" type="text/css" href="shared/shiny.css"/>
<style>
body { font-family: Helvetica, Arial, sans-serif; }
</style>
</head>
<body>
<br>
<form action="">
<div><input id="runButton" type="submit" name="submit" value="Press me!" class="button action-button"></div>
</form>
<br>
</body>
</html>
我的问题是为什么在得到&#34;检测到的按钮之前我需要按两次按钮(至少)按下&#34;?如何编辑我的代码才能按下一个按钮?