1

我的 JSF 表单包含一个弹出面板。代码在这里:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:f="http://java.sun.com/jsf/core">

<h:head>
    <title>Partner Manager</title>
    <link href="stylesheet/reset.css" rel="stylesheet" type="text/css" />
    <link href="stylesheet/style.css" rel="stylesheet" type="text/css" />
    <link rel="icon" type="image/png" href="images/icons/favicon.png" />
    <script src="script/script.js" />
</h:head>
<h:body>
    <h:outputText id="progress_bar" styleClass="progress-bar" />
    <div id="header">
        <div class="header-content">
            <img src="images/logo2.png" />
            <div class="header-message">
                <p class="links">
                    <a href="#">Sign Out</a>
                </p>
                <p class="welcome">
                    Welcome <label>John Smith</label> <span>Associate Manger</span>
                </p>
            </div>
        </div>
    </div>
    <div id="container">
        <h:form>
            <fieldset class="search-area">

                <rich:calendar value="#{partnerBean.selectedStartDate}"
                    datePattern="yyyy-MM-dd" />

                <rich:calendar value="#{partnerBean.selectedEndDate}"
                    datePattern="yyyy-MM-dd" />

                <h:selectOneMenu label="Categories" id="categories"
                    style="width:200px" styleClass="dilevery"
                    value="#{partnerBean.selectedDeliveryMethod}">
                    <f:selectItem itemLabel="Select Type" itemValue="Select Type" />
                        <f:selectItem itemLabel="Select Type" itemValue="Select Type" />
                    <f:selectItem itemLabel="Select Type" itemValue="Select Type" />
                    <f:selectItem itemLabel="Select Type" itemValue="Select Type" />
                </h:selectOneMenu>

                <a4j:commandButton id="searchButton" value="Search"
                    onbegin="showProgressBar();" oncomplete="hideProgressBar();"
                    render="@form,tableDv,transactionTable"
                    action="#{partnerBean.searchPartnersTransactions}"
                    styleClass="search-btn" />

                <a4j:commandLink href="#" styleClass="add-teller"
                    title="Add Partner">Add Partner
                    <rich:componentControl target="popup" operation="show" />
                </a4j:commandLink>
            </fieldset>

            <div class="tableDv">
                <rich:dataTable id="transactionTable"
                    value="#{partnerBean.partnerTransactions}" var="transaction">

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Date of Transaction" />
                        </f:facet>
                        <h:outputText value="#{transaction.dateOfTransaction}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Transaction ID" />
                        </f:facet>
                        <h:outputText value="#{transaction.transactionID}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Recipient name" />
                        </f:facet>
                        <h:outputText value="#{transaction.recipientName}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Amount Sent" />
                        </f:facet>
                        <h:outputText value="#{transaction.amountSent}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Recipient's Phone No" />
                        </f:facet>
                        <h:outputText value="#{transaction.recipientPhoneNumber}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Sender's name" />
                        </f:facet>
                        <h:outputText value="#{transaction.senderName}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Type of Delivery Method" />
                        </f:facet>
                        <h:outputText value="#{transaction.typeOfDelivery}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Partner Fee" />
                        </f:facet>
                        <h:outputText value="#{transaction.partnerFee}" />
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Status of Transfer" />
                        </f:facet>
                        <h:outputText value="#{transaction.statusOfTransfer}" />
                    </rich:column>
                </rich:dataTable>
            </div>

            <h:panelGroup layout="block" id="container" style="overflow:scroll">
                <rich:popupPanel id="popup" modal="true" autosized="true"
                    resizeable="false" domElementAttachment="form"
                    followByScroll="true">
                    <f:facet name="header">
                        <h:outputText value="Process Teller Transaction" />
                    </f:facet>
                    <f:facet name="controls">
                        <h:outputLink value="#"
                            onclick="#{rich:component('popup')}.hide(); return false;">
                        x
                     </h:outputLink>
                    </f:facet>
                    <div id="container">
                        <fieldset class="add-form">
                            <legend>Add Account</legend>

                            <p class="choose-type">
                                <label>Account Type :</label> <select class="account-type"><option>Partner</option></select>
                            </p>
                            <p>
                                <label>Partner Name :</label><input type="text"
                                    value="Enter Partner Name" class="partner-name" />
                            </p>
                            <p>
                                <label>Email Address :</label><input type="text"
                                    value="Enter Email Address" class="email-fld" />
                            </p>
                            <p>
                                <label>Address :</label><input type="text"
                                    value="Enter Postal Address" class="address-fld" />
                            </p>
                            <p>
                                <label>City :</label><select class="city-fld"><option>Select
                                        City</option></select>
                            </p>
                            <p>
                                <label>Partner Limit :</label><select class="limit-fld"><option>Select
                                        Limit</option></select>
                            </p>
                            <p>
                                <input type="submit" value="Create Account" class="search-btn" />
                            </p>

                        </fieldset>
                    </div>
                </rich:popupPanel>
            </h:panelGroup>
        </h:form>
    </div>

    <div id="footer">
        <div class="footer-content">
            <div class="footer-liks">
                <a href="#">Home</a> | <a href="#">Company Profile</a> | <a href="#">Partner's</a>
                | <a href="#">Survey</a> | <a href="#">Jobs</a> | <a href="#">Press</a>
                | <a href="#">Contact Us</a> <span>Copyright © 2012
                    CoinFling.com. All rights reserved. <a href="#">Privacy Policy</a>
                    - <a href="#">Terms of Service</a>
                </span>
            </div>
        </div>
    </div>
</h:body>
</html>

弹出窗口显示。但是,如果内容太大,则不会出现滚动条。如何让滚动条在需要时始终出现?

4

1 回答 1

3

您是否尝试在 div 上设置样式?

<h:panelGroup layout="block" id="container" style="overflow:scroll"> ... </h:panelGroup>

如果可行,那么最好的方法是定义一个类。

也许您还必须明确定义弹出窗口的大小以使其正常工作。

更新:

最终的解决方案是在没有任何额外样式信息的情况下使用<h:panelGroup>..</h:panelGroup>内部的块。<rich:popupPanel>已经使用其内容周围<rich:popupPanel>的样式呈现了一个 div,overflow:auto但如果其中只有纯 html 代码,则弹出窗口的大小计算似乎失败。

于 2012-10-23T13:28:47.433 回答