Primefaces selectOneRadio(RadioButton)在Dialog中更新panelGrid

时间:2014-07-10 08:26:12

标签: ajax jsf primefaces

我试图在对话框中更新panelgrid表单selectOneRadio。 每当我选择这两个选项时,整个panelGrid崩溃和NPE都是没有任何细节的。“

我的源代码:

<h:form id="form_tmpVst">
        <p:dialog id="dialog_tmpVst" header="Temporäre Verkaufsstelle" widgetVar="dialog_tmpVst" modal="true" resizable="false" showEffect="clip">

            <p:selectOneRadio id="radio_placeOnMap" value="#{mapBean.placedByAddress}" layout="custom">
                <f:selectItem itemLabel="Karte" itemValue="#{false}" />
                <f:selectItem itemLabel="Adresse" itemValue="#{true}" />
                <p:ajax update="panel_tmpVst" />
                <!-- <p:ajax @process="@this" update="@this panelTempVst" /> -->
            </p:selectOneRadio>

            <p:panelGrid id="panel_tmpVst">
                <p:row>
                    <p:column colspan="2">
                        <p:outputLabel value="Platzierung: " />
                    </p:column>
                </p:row>
                <p:row>
                    <p:column>
                        <p:radioButton id="radio_tmpVstPlaceByAddress" for="radio_placeOnMap" itemIndex="0" />
                        <p:outputLabel value="Karte" for="radio_tmpVstPlaceByAddress" />
                    </p:column>
                </p:row>
                <p:row>
                    <p:column>
                        <p:radioButton id="radio_tmpVstPlaceByMap" for="radio_placeOnMap" itemIndex="1" />
                        <p:outputLabel value="Adresse" for="radio_tmpVstPlaceByMap" />
                    </p:column>
                    <p:column>
                        <p:inputTextarea id="txtarea_address" rows="5" cols="30" counter="txtarea_counter" maxlength="200" counterTemplate="{0} Zeichen übrig."
                            autoResize="false" value="test data __öäüöäöüöäö" required="#{mapBean.placedByAddress}" disabled=" #{!mapBean.placedByAddress}"
                            style="resize: none;" />
                        <br />
                        <h:outputText id="txtarea_counter" style="font-size: .5em;" />
                    </p:column>
                </p:row>

                <p:row>
                    <p:column>
                        <p:outputLabel value="Name:" for="txt_tmpname" />
                    </p:column>
                    <p:column>
                        <p:inputText id="txt_tmpname" value="#{mapBean.tmpVstName}" required="true" />
                    </p:column>
                </p:row>
                <p:row>
                    <p:column>
                        <p:outputLabel value="BST:" for="txt_bsttmp" />
                    </p:column>
                    <p:column>
                        <p:inputText id="txt_bsttmp" value="#{mapBean.tmpDistrict}" required="true" />
                    </p:column>
                </p:row>
                <p:row>
                    <p:column>
                        <p:outputLabel value="VST:" for="txt_vsttmp" />
                    </p:column>
                    <p:column>
                        <p:inputText id="txt_vsttmp" value="#{mapBean.tmpVstNumber}" required="true" />
                    </p:column>
                </p:row>
            </p:panelGrid>
            <br />
            <p:commandButton value="Hinzufügen" id="btn_addTmpVst" action="#{mapBean.addTempVst()}" type="submit" ajax="true"
                update=":dataTableForm:markerListDataTable, :mapForm:map, :growl" oncomplete="PF('dialog_tmpVst').hide();" />
        </p:dialog>
    </h:form>

在: enter image description here

单击按钮后点击:

enter image description here

非常感谢advence

1 个答案:

答案 0 :(得分:1)

这是正常的,基本上您是在没有通知所有者(h:panelGrid)的情况下更新包含p:radioButton的{​​{1}}。

要解决此更新p:selectOneRadiop:selectOneRadio一起,这样渲染就会按预期工作:

h:panelGrid