【发布时间】:2020-10-27 18:26:46
【问题描述】:
我有一个重复控件,它使用 javascript 从 sql 表中调用数据。重复有一个包含表中数据的列名和另一个带有复选框的列。勾选复选框以将重复数据存储在单独的表中。单击按钮时,我想清除重复中的所有复选框。我该怎么做?
这是我尝试过的。
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.resources>
<xp:script src="/scriptsNewConflictRequest.jss" clientSide="false"></xp:script>
</xp:this.resources>
<xp:repeat id="repeat1" rows="30" var="rowData" value="#{javascript:getBusinessUnitsCR()}">
<xp:table style="width:99.0%">
<xp:tr>
<xp:td style="width:50.0%">
<xp:label value="#{javascript:rowData.busUnit}" id="label4"></xp:label>
</xp:td>
<xp:td align="center" style="width:20%">
<xp:checkBox text="Yes" id="checkBU" checkedValue="Yes" uncheckedValue="No">
<xp:eventHandler event="onchange" submit="true" refreshMode="norefresh"
id="eventHandler1">
<xp:this.action><![CDATA[#{javascript:saveOrDelBU();}]]</xp:this.action>
</xp:eventHandler>
</xp:checkBox>
</xp:td>
</xp:tr>
</xp:table>
</xp:repeat>
<xp:button value="Clear Check Boxes" id="button3">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete" id="eventHandler4">
<xp:this.action><![CDATA[#{javascript:
//Method 1
getComponent("checkBU").setValue("No");}]]>//Did Not Work
//Method 2
context.redirectToPage(context.getUrl().toString());//Does not help because the page is on a switch facet and it does not redirect back to this page.
</xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
尝试了上面列出的两种方法。不知道还能尝试什么。
【问题讨论】:
标签: javascript xpages xpages-ssjs