每次点击复选框时,我的页面都会刷新。我使用JavaScript如下:
input.setOnkeypress("if (event.keyCode == 13) {document.getElementById('search_report_form:search_button').onclick(); return true}");
final class GroupsSelector extends BaseRenderablePanel<GroupsSelector> {
private GroupsSelector group(LabourInputReportCriteria.Level level) {
HtmlSelectBooleanCheckbox box = new HtmlSelectBooleanCheckbox();
boolean isSelected = selections.isGroupSelected(level);
box.setSelected(isSelected);
// box.setDisabled(isDaySelectedOnFirst(level));
box.setId("groupBy" + level.getClass().getSimpleName());
box.setOnclick("submit()");
box.addValueChangeListener(u.addExpressionValueChangeListener("#{reportSearchCriteriaModel.groupBy}"));
HtmlOutputText labelComponent = new HtmlOutputText();
labelComponent.setValue(getGroupSelectionValue(level));
tr().td();
html(box);
html(" ");
html(labelComponent);
endTd().endTr();
return this;
}
有没有办法在每次单击复选框时避免刷新页面?
请帮忙。
谢谢, Shruthi