xhtml代码: -
当我点击按钮时,它调用了对话框,在对话框中有选择列表,但是我选择列表为空,因为Action标记不起作用而且它没有调用loadtype方法。
<p:commandButton id="showWoOnHold"
value="showWoOnHold"
icon="img-magnifier-16x16"
action="#{workOrderTypeCrud.loadType}"
onsuccess="showWoOnHoldDialog();">
<p:ajax update=":woOnHoldForm" />
</p:commandButton>
<ui:define name="dialogs">
<p:dialog widgetVar="woOnHold" modal="true"
closable="false" minHeight="100"
header="#{crud['work.order.type.on.hold.types']}">
<h:form id="woOnHoldForm" prependId="false">
<h:panelGrid>
<h:panelGrid cellpadding="0" cellspacing="0">
<h:panelGrid columns="2" cellpadding="0" cellspacing="0">
<h:outputLabel value="#{crud['work.order.type.description']}"
for="typeDescription" />
</h:panelGrid>
<h:panelGrid columns="2" cellpadding="0" cellspacing="0">
<p:inputText id="typeDescription"
value="#{workOrderTypeCrud.instance.description}"
label="#{crud['work.order.type.description']}"
maxlength="60"
disabled="true"/>
</h:panelGrid>
</h:panelGrid>
</h:panelGrid>
<h:panelGroup id="pickListWo">
<div id="pickList">
<p:pickList converter="PrimeFacesPickListConverter"
id="fieldPickListWo"
value="#{workOrderTypeCrud.fieldsWoOnHold}"
itemLabel="#{field.code}"
itemValue="#{field}"
var="field"
showTargetControls="true"
addLabel="#{crud['profile.add']}"
addAllLabel="#{crud['profile.add.all']}"
removeLabel="#{crud['profile.remove']}"
removeAllLabel="#{crud['profile.remove.all']}"
moveUpLabel="#{crud['profile.move.up']}"
moveDownLabel="#{crud['profile.move.down']}"
moveTopLabel="#{crud['profile.move.top']}"
moveBottomLabel="#{crud['profile.move.bottom']}"/>
</div>
</h:panelGroup>
<h:panelGroup>
<div style="float: right; padding-top:10px">
<p:commandButton id="woSaveTypes"
action="#{workOrderTypeCrud.saveWoOnHold}"
value="#{actions['save']}"
icon="img-green-check-16x16">
<p:ajax update=":messages" />
</p:commandButton>
<p:commandButton
action="#{workOrderTypeCrud.cancel}"
value="#{actions['cancel']}"
label="#{actions['cancel']}"
icon="img-delete-16x16"
onclick="hideWoOnHoldDialog()"/>
<p:commandButton
value="#{actions['close']}"
label="#{actions['close']}"
icon="img-close-window-16x16"
onclick="hideWoOnHoldDialog()"/>
</div>
</h:panelGroup>
</h:form>
</p:dialog>
Bean: -
public void loadType() {
loadFields();
// rest of code to get the list of value for loadtype.
}
操作标记无效。即使我无法使用更新更新“woOnHoldForm”。我发布了一半代码(你可以理解这个过程),因为它的代码很大。