-1

我有一个 xhtml 文件。当我放置一个 id=a 的命令按钮时,我的表单很混乱。如果我想在 oneRow 中放置 outPutLabe、autoComplete 和 commandButton 是什么?我想在第一行放置三个组件,然后将每个两个组件放置在单独的行中。

    <h:form id="frm">
        <p:messages globalOnly="false" styleClass="error" autoUpdate="true" id="msgDiseaseHistory"/>
        <p:outputPanel id="PanleId">
            <h:panelGrid columns="3">
                <h:panelGroup>
                    <fieldset>
                        <legend>History:</legend>
                        <h:panelGrid id="Grid" columnClasses="label,component,required"
                                     columns="2">
                            <p:outputLabel for="EMRName" value="Name:"/>
                            <p:autoComplete id="EMRName"
                                            value="#{record.dermatology}"
                                            completeMethod="#{record.complete}"
                                    />
                            <p:commandButton id="a" value="+"
                                             action="#{record.add}"
                                             onclick="PF('addDlg').show();"/>


                            <p:outputLabel for="date" value="StartDate:"/>
                            <p:calendar id="date"
                                        value="#{record.date}"
                                        pattern="yyyy-MMM-dd"
                                        converter="dateConverter"/>

                            <p:outputLabel for="duration" value="Duration:"/>
                            <p:inputText id="duration"
                                         value="#{record.duration}"/>


                            <p:outputLabel for="description" value="Description:"/>
                            <p:inputTextarea id="description"
                                             value="#{record.description}"/>
                        </h:panelGrid>


                    </fieldset>
                </h:panelGroup>
                <h:panelGroup>
                    <fieldset>
                        <legend>Disease:</legend>
                        <h:panelGrid id="diseaseGrid" columnClasses="label,component,required"
                                     columns="2">

                            <p:outputLabel for="diseaseName" value="Name:"/>
                            <p:inputText id="diseaseName"
                                         value="#{record.disease}"/>

                            <p:outputLabel for="historyDate" value="StartDate:"/>
                            <p:calendar id="historyDate"
                                        pattern="yyyy-MMM-dd"
                                        converter="dateConverter"
                                        value="#{record.diseaseDate}"/>

                            <p:outputLabel for="EMRBeanDiseaseHistoryDuration" value="Duration:"/>
                            <p:inputText id="history"
                                         value="#{record.diseaseDuration}"/>

                            <p:outputLabel for="Efrg" value="Description:"/>
                            <p:inputTextarea id="Efrg"
                                             value="#{record.diseaseDescription}"/>
                        </h:panelGrid>
                    </fieldset>
                </h:panelGroup>

            </h:panelGrid>
            <h:panelGrid columns="2">
                <h:panelGroup>
                    <fieldset>
                        <legend>Family:</legend>
                        <h:panelGrid id="FamilyHistoryGrid" columnClasses="label,component,required"
                                     columns="2">
                            <p:outputLabel for="historyName" value="Description:"/>
                            <p:inputTextarea id="historyName"
                                             value="#{record.tree}"/>
                        </h:panelGrid>
                    </fieldset>
                </h:panelGroup>
                <h:panelGroup>
                    <fieldset>
                        <legend>Family:</legend>
                        <h:panelGrid id="familyGrid" columnClasses="label,component,required"
                                     columns="2">

                            <p:outputLabel for="family" value="Description:"/>
                            <p:inputTextarea id="family"
                                             value="#{record.family}"/>
                        </h:panelGrid>
                    </fieldset>
                </h:panelGroup>

            </h:panelGrid>


            <h:panelGrid id="buttonsGrid" columnClasses="label,component,required" columns="2">
                <h:panelGroup>
                    <p:commandButton value="Save" action="#{record.save}"
                                     update=":create"
                                     oncomplete="if(!args.validationFailed  &amp;&amp; args.saved )PF('HistoryDlg').hide();"
                                     ajax="true"

                            />

                </h:panelGroup>
                <h:outputText/>
            </h:panelGrid>

        </p:outputPanel>
    </h:form>
4

1 回答 1

0

您在第一个 panelGrid 中定义了三列,但仅用于引导子级 (panelGroup)。只需了解 panelGrid 的工作原理。如果您已经定义了两列(如在第二个 panelgrid 中,它采用每对子项并将其放在 col1 和 col2 中。如果您(您自己)通过添加一个 commandButton 搞砸了,一切都会移动......所以要么添加例如在 commandButton 之后或之前附加空白,或将 commandbutton 移动到其他位置。

于 2015-01-30T16:01:47.457 回答