[英]<p:commandButton> not getting scrolled along with the <p:scrollPanel>
[英]p:commandButton mull functioning
p:commandButton
沒有要在actionListener
調用的方法。 我剛剛使用它來隱藏對話框editSensorDialog
但是它在p:selectOneMenu
的valueChangeListener
調用了addDeviceMappings
方法。
我的代碼中有什么錯誤,為什么p:commandButton
調用不必要?
上述問題的完整代碼:
<p:dialog id="editSensorDialog" style="width: 360px;" width="360" height="400"
modal="true" widgetVar="editSensorDialog" resizable="false" >
<p:dataTable id="editSensorList" value="#{sensorController.sensorsMappingList}"
var="item" rowIndexVar="rowIndex">
<p:column headerText="#{bundle['label.Sensor']}" id="editdeviceName">
<h:outputText rendered="false" value="#{item.value}"/>
<p:selectOneMenu valueChangeListener="#{sensorController.addDeviceMappings}">
<p:ajax update="@this"/>
<f:selectItems value="#{item.value}" var="sensor" itemLabel="#{sensor}"
itemValue="#{item.name}+#{sensor}"/>
</p:selectOneMenu>
</p:column>
<f:facet name="footer">
<p:commandButton value="#{bundle['label.Submit']}"
onsuccess="editSensorDialog.hide()"/>
</f:facet>
</p:dataTable>
最簡單的方法是將JavaScript從onsuccess
改為onclick
並停止傳播。
<p:commandButton value="#{bundle['label.Submit']}" onclick="editSensorDialog.hide();return false;"/>
另外,使用p:commandButton
對該任務有點過大,任何簡單的HTML元素都可以完成此工作( <input type="button" value="#{bundle['label.Submit']}" />
或<a>#{bundle['label.Submit']}</a>
等。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.