我需要使用 . 单击选择/取消选择所有复选框CardService
。
如何实现onclick
处理函数?
我尝试过:
function handlerOfButtonClick(e) {
var selectAll = CardService.newSelectionInput()
.setType(CardService.SelectionInputType.CHECK_BOX)
.setFieldName("select_all")
.addItem("Select all", "selectAll", false).setOnChangeAction(CardService.newAction()
.setFunctionName("handleSelectAll"));
var checkboxGroup = CardService.newSelectionInput()
.setType(CardService.SelectionInputType.CHECK_BOX)
.setTitle("A group of checkboxes. Multiple selections are allowed.")
.setFieldName("checkbox_field")
.addItem("checkbox one title", "checkbox_one_value", false)
.addItem("checkbox two title", "checkbox_two_value", true)
.addItem("checkbox three title", "checkbox_three_value", true);
var section = CardService.newCardSection().addWidget(selectAll).addWidget(checkboxGroup)
var card = CardService.newCardBuilder().addSection(section);
var navigation = CardService.newNavigation().pushCard(card.build());
var actionResponse = CardService.newActionResponseBuilder().setNavigation(navigation);
return actionResponse.build();
}
function handleSelectAll(e) {
//?????
}