我正在编写一个闪亮的应用程序,以帮助我实验室中的某些人探索我们的仪器生成的数据。我们希望根据常见和已知条件调整一组输入,因此我添加了一组给出条件选项的单选按钮。用户可以选择他们感兴趣的条件,然后 DBObject query = QueryBuilder.start().put("ts").greaterThanEquals(startdate).lessThanEquals(enddate).and("dup").exists(false).get();
DBObject match = new BasicDBObject("$match", query);
DBObject project=new BasicDBObject("$project", new BasicDBObject("ts",new BasicDBObject("$add",5.5*3600*1000)));
DBObject group = new BasicDBObject("$group", new BasicDBObject("_id",new BasicDBObject("day", new BasicDBObject("$dayOfMonth", "$ts"))
).append("count", new Document("$sum", 1)));
AggregationOutput output = collection.aggregate(match,group);
for (DBObject result : output.results()) {
System.out.println(result);
}
函数用于将用户界面上的输入更改为适当的值。
到目前为止,一切正常,直到我尝试使用update*
。我似乎无法按预期更新复选框组。有没有其他人观察到同样的情况,你能看到我编码错误吗?
ui.R
updateCheckboxGroupInput
server.R
shinyUI(
sidebarLayout(
sidebarPanel(
radioButtons("ctrl_gen_customDefault",
"User Defined Defaults",
c("System Defaults" = "none",
"Condition A" = "conditionA")),
checkboxGroupInput("ctrl_gen_challengenumber",
label = "Challenge Number",
choices = c("First" = 1,
"Second" = 2,
"Third" = 3),
selected = 1:3)
),
mainPanel()
)
)
理想情况下,当您选中条件A的单选按钮时,“挑战号码”的复选框组输入应更改为仅选择“秒”。
答案 0 :(得分:2)
checkboxGroupInput
生成的值是字符串,为了匹配这些值,您必须将字符向量传递给selected
:
updateCheckboxGroupInput(
session,
"ctrl_gen_challengenumber",
label = "Challenge Number",
choices = c("First" = 1,
"Second" = 2,
"Third" = 3),
selected = "2")