PrimeFaces ajax不更新表单组件

时间:2014-03-21 05:00:34

标签: jsf jsf-2 primefaces ajax4jsf jsf-2.2

我一直在尝试使用primefaces ajax来更新表单组件。但更新属性不会更新。

让我详细说明:

我的表单中有两个selectonemenu,我想从菜单中选择所选值,然后在提交按钮上单击我想要更新dataTable并填充各自的数据..

<p:outputLabel id="state" value="State Name"></p:outputLabel>
            <p:selectOneMenu id="statemenu" style="width:300px;"
                value="#{MenuBean.state}">
                <f:selectItem itemLabel="Select One"></f:selectItem>
                <f:selectItems value="#{MenuBean.stateList}"></f:selectItems>
                        </p:selectOneMenu>

            <br></br>
            <p:outputLabel value="District"></p:outputLabel>
            <p:selectOneMenu id="dist" style="width:300px;"
                value="#{MenuBean.district}">
                <f:selectItem itemLabel="Select One"></f:selectItem>
                <f:selectItems value="#{MenuBean.districtList}"></f:selectItems>

            </p:selectOneMenu>



<p:commandButton id="btnSubmit" value="Submit" type="submit"
                        partialSubmit="true" process="statemenu,dist,@this"
                        actionListener="#{MenuBean.setVisiblity}"
                        action="#{MenuBean.getValues}" 

                       title="Submit"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",  "Hoefler Text", Garamond, "Times New Roman", serif; font-size: 14px; font-weight: normal'>


                    </p:commandButton>

这是Backing Bean

    public void getValues() {
    System.out.println("getting the values");

    DataTable.getDataTable(state, district);

    System.out.println(DataTable.Filter);
    System.out.println(DataTable.isLoaded);
    System.out.println(state);
    System.out.println(district);

}

public void setVisiblity(ActionEvent event) {
    DataTable.Filter = false;
    DataTable.isLoaded = true;
    System.out.println(event.getSource().toString());
    System.out.println("Enters the actionListener");

}

这是我要渲染的数据表和我希望在点击

时隐藏的过滤器面板
    <p:dataTable id="disptable" var="table" lazy="true"
            rowKey="#{table.sheet_no}" selectionMode="single"
            selection="#{DataTable.selectedSheet}" scrollable="true"
            scrollHeight="115" rendered="#{DataTable.loaded}"
            style="widht:auto ; margin-left:420px;margin-right:30px ;box-shadow: 10px 10px 25px #888888;"
            widgetVar="tabl" emptyMessage="No Records to display.">

            <p:column headerText="Sheet Number" style="width:25%">
                <h:outputLabel value="#{table.sheet_no}"></h:outputLabel>
            </p:column>

            <p:column headerText="State" style="width:25%">
                <h:outputLabel value="#{table.state_cd}"></h:outputLabel>
            </p:column>

            <p:column headerText="District" style="width:25%">
                <h:outputLabel value="#{table.district_cd}"></h:outputLabel>
            </p:column>



            <f:facet name="footer">
                <p:commandButton id="selectButton" title="Show Complete Details"
                    icon="./images/show.png" update=":form:disp"
                    oncomplete="PF('Dialog').show()" process="@this,disptable"
                    style="height:25px;" ajax="true" iconPos="center" />

                <p:commandButton style="height:25px;" id="addCart"
                    title="Add to Cart" icon="./images/cart.png" global="false" />

                <p:commandButton style="height:25px;" id="location"
                    update=":form:tabs:MapDetails" process="@this,disptable"
                    title="Show Co-ordinates" icon="./images/cart.png" global="false" />

            </f:facet>
        </p:dataTable>

<h:panelGrid id="filter" columns="1" cellpadding="10" cellspacing="2"
            rendered="#{DataTable.filter}" 
            style="position:absolute;bottom:15px;right:80px;border: 1px solid #1f497d;box-shadow: 10px 10px 25px #888888;
        height:auto;width:600px;Text-align:center;">
            <p:outputLabel value="Filter your search to get result."></p:outputLabel>
        </h:panelGrid>
    </h:panelGrid>

这是整个页面

<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <link href="./css/extra-styles.css" rel="stylesheet" type="text/css" />
    <link href="./css/menustyles.css" rel="stylesheet" type="text/css" />
    <title>SOI MAP TRANSACTION REGISTRY :: MAP</title>
</h:head>
<body>
    <h:form id="form">
        <f:event type="preRenderView" listener="#{DataTable.init}" />
        <div id="header">
            <div style="height: 151px;">
                <img id="logo"
                    style="position: relative; left: 60px; height: 146px; width: 100px"
                    src="images\img.gif" />
                <h:panelGrid id="panel1" columns="1"
                    style="position: absolute; bottom: auto; left: 175px; right: auto; top: 30px ">
                    <h:outputText id="output1" value="Survey of India"
                        style='line-height: normal; font-variant: normal; color: #400040; text-transform: none; font-style: normal; font-size: xx-large; font-family: "Times New Roman", Serif; font-weight: normal'></h:outputText>
                    <h:outputText styleClass="shadow" value="Map Transaction Registry"
                        style='font-style: italic; font-size: xx-large; font-family: Georgia, "Times New Roman", Serif; font-weight: normal'
                        id="shadow"></h:outputText>
                </h:panelGrid>
                <div id="div1"
                    style="height: 5px; widht: auto; background-color: #CDCDCD; position: relative; top: 12px; bottom: auto; left: auto; right: auto"></div>
                <hr id="hr"
                    style="height: 5px; widht: auto; position: relative; top: 3px; bottom: auto; left: auto; right: auto" />
            </div>
            <div id="div2"
                style="background: #616063; height: 44px; width: auto; position: relative"></div>
            <div id='cssmenu'>
                <ul>
                    <li><a href='index.xhtml'><span>Home</span></a></li>
                    <li><a href='#'><span>About Us</span></a></li>
                    <li><a href='#'><span>Our Products</span></a></li>
                    <li><a href="search.xhtml"><span>Search Image</span></a></li>
                    <li><a href='#'><span>Contact</span></a></li>
                    <li class='last'><a href='signup.xhtml'><span>New
                                User</span></a></li>
                </ul>
            </div>
        </div>

        <p:fieldset rendered="#{!login_bean.validationComplete}">
            <img
                style="position: absolute; left: 10px; top: 45px; height: 45px; width: 45x"
                src="images\login.gif" />
            <p:growl id="growl" showDetail="false" sticky="false" life="3000"
                autoUpdate="TURE" />
            <h:panelGrid columns="4" class="formTable"
                style="position: relative; left: 35px; top: 6px ;">
                <p:outputLabel value="Login/Email" style='font-size: 16px;' />
                <p:inputText value="#{login_bean.username}" id="username"
                    required="true" requiredMessage="Please Enter the username"
                    style="height:15px; width:auto;" />

            </h:panelGrid>

            <h:panelGrid columns="4" class="formTable"
                style="position: relative; left: 35px; top:6px">
                <p:outputLabel value="Password" style='font-size: 16px;' />
                <br />
                <p:password style="height:15px;position: relative; left: 8px"
                    id="password" value="#{login_bean.password}" required="true"
                    requiredMessage="Please Enter the Password">



                </p:password>
            </h:panelGrid>
            <h:panelGrid columns="3" class="formTable"
                style="position: relative; left: 80px; top: 6px">
                <br />
            </h:panelGrid>

            <h:commandButton id="btnLogin" value="Login"
                action="#{login_bean.check}" type="submit" update="true"
                style="position: relative; left:245px; top:-20px ; height:25px;widht:38;text-align: center; font-size: 14px;" />
            <p:commandLink id="link"
                style="position: relative; left:70px; top:-20px ;font-size:13px;"
                value="Forgot Password ?"></p:commandLink>


        </p:fieldset>

        <p:fieldset rendered="#{login_bean.validationComplete}">
            <img
                style="position: absolute; left: 10px; top: 30px; height: 65px; width: 55px"
                src="images\icon.png" />


            <h:panelGrid columns="1" class="formTable"
                style="position: relative; left: 35px; top: 6px ;">

                <p:outputLabel
                    value="Welcome #{login_bean.username} to Map Tansaction Registry"
                    style='font-size: 16px; color: red;  text-align: center;   font-style: bold; font-family: "Times New Roman", Serif; font-weight: bold' />
            </h:panelGrid>

            <h:panelGrid columns="4" class="formTable"
                style="position: relative; left: 55px; top: 6px ;" cellpadding="3"
                cellspacing="3">
                <h:graphicImage url="images\cart.png"></h:graphicImage>
                <h:commandLink value="Cart"
                    style='font-size: 15px; color:green;  text-align: center;   font-style: normal; font-family: Georgia, Times, "Times New Roman", serif; font-weight: normal'></h:commandLink>
                <h:graphicImage url="images\edit.png"></h:graphicImage>
                <h:commandLink value="Edit Details"
                    style='font-size: 15px; color:green;  text-align: center;   font-style: normal; font-family: Georgia, Times, "Times New Roman", serif; font-weight: normal'></h:commandLink>
                <h:graphicImage url="images\pass.png"></h:graphicImage>
                <h:commandLink value="Change Password"
                    style='font-size: 15px; color:green;  text-align: center;   font-style: normal; font-family: Georgia, Times, "Times New Roman", serif; font-weight: normal'></h:commandLink>
                <h:graphicImage url="images\logout.png"></h:graphicImage>
                <h:commandLink value="Logout" action="#{login_bean.logout}"
                    style='font-size: 15px; color:green;  text-align: center;   font-style: normal; font-family: Georgia, Times, "Times New Roman", serif; font-weight: normal'></h:commandLink>
            </h:panelGrid>

        </p:fieldset>

        <!-- Search Tab View -->
        <p:tabView activeIndex="2">
            <p:tab title="Map Sheet">
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Map Sheet No :" />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>
                <br />
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Scale/GSD " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:selectOneMenu tabindex="1" style="height:25px;widht:auto;">
                        <f:selectItem itemLabel="--  ALL  --" itemValue="all"></f:selectItem>
                        <f:selectItem itemLabel="5000" itemValue="5000"></f:selectItem>
                        <f:selectItem itemLabel="6000" itemValue="6000"></f:selectItem>
                        <f:selectItem itemLabel="8000" itemValue="8000"></f:selectItem>
                        <f:selectItem itemLabel="10000" itemValue="10000"></f:selectItem>
                        <f:selectItem itemLabel="12500" itemValue="12500"></f:selectItem>
                        <f:selectItem itemLabel="15000" itemValue="15000"></f:selectItem>
                        <f:selectItem itemLabel="25000" itemValue="25000"></f:selectItem>
                        <f:selectItem itemLabel="30000" itemValue="30000"></f:selectItem>
                        <f:selectItem itemLabel="40000" itemValue="40000"></f:selectItem>
                        <f:selectItem itemLabel="50000" itemValue="50000"></f:selectItem>
                    </p:selectOneMenu>
                </h:panelGrid>
                <br />
                <br />
                <h:panelGrid style="position:relative; left:165px" columns="2"
                    cellpadding="2" cellspacing="2">
                    <p:commandButton value="Reset"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                    <p:commandButton id="submit" value="Submit"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                </h:panelGrid>

                <!--    <h:panelGrid>
                    <p:graphicImage url="images/tips.png"></p:graphicImage>
                    <p:outputLabel value="Tips :"></p:outputLabel>
                </h:panelGrid> -->

            </p:tab>
            <p:tab title="Lat/Long">


                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Lat BL : " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>

                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Lng BL : " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Lat TR : " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Lng TR : " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>

                <br />
                <p:commandLink value="Grab bounding from the Map"></p:commandLink>
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Scale/GSD"></p:outputLabel>
                    <p:selectOneMenu tabindex="1">
                        <f:selectItem itemLabel="--  ALL  --" itemValue="all"></f:selectItem>
                        <f:selectItem itemLabel="5000" itemValue="5000"></f:selectItem>
                        <f:selectItem itemLabel="6000" itemValue="6000"></f:selectItem>
                        <f:selectItem itemLabel="8000" itemValue="8000"></f:selectItem>
                        <f:selectItem itemLabel="10000" itemValue="10000"></f:selectItem>
                        <f:selectItem itemLabel="12500" itemValue="12500"></f:selectItem>
                        <f:selectItem itemLabel="15000" itemValue="15000"></f:selectItem>
                        <f:selectItem itemLabel="25000" itemValue="25000"></f:selectItem>
                        <f:selectItem itemLabel="30000" itemValue="30000"></f:selectItem>
                        <f:selectItem itemLabel="40000" itemValue="40000"></f:selectItem>
                        <f:selectItem itemLabel="50000" itemValue="50000"></f:selectItem>
                    </p:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:panelGrid style="position:relative; left:165px" columns="2"
                    cellpadding="2" cellspacing="2">
                    <p:commandButton value="Reset"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                    <p:commandButton value="Submit"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                </h:panelGrid>
            </p:tab>
            <p:tab title="Name">

                <h:panelGrid columns="1">
                    <p:outputLabel id="state" value="State Name"></p:outputLabel>
                    <p:selectOneMenu id="statemenu" style="width:300px;"
                        value="#{DropDown.selectedState}">
                        <f:selectItem itemLabel="Select One"></f:selectItem>
                        <f:selectItems value="#{DropDown.stateList}"></f:selectItems>
                    </p:selectOneMenu>

                    <br></br>
                    <p:outputLabel value="District"></p:outputLabel>
                    <p:selectOneMenu id="dist" style="width:300px;"
                        value="#{DropDown.selectedDistrict}">
                        <f:selectItem itemLabel="Select One"></f:selectItem>
                        <f:selectItems value="#{DropDown.districtList}"></f:selectItems>
                    </p:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:panelGrid columns="2">

                    <p:outputLabel value="Scale/GSD"></p:outputLabel>
                    <p:selectOneMenu tabindex="1">
                        <f:selectItem itemLabel="   --ALL--   " itemValue="all"></f:selectItem>
                        <f:selectItem itemLabel="5000" itemValue="5000"></f:selectItem>
                        <f:selectItem itemLabel="6000" itemValue="6000"></f:selectItem>
                        <f:selectItem itemLabel="8000" itemValue="8000"></f:selectItem>
                        <f:selectItem itemLabel="10000" itemValue="10000"></f:selectItem>
                        <f:selectItem itemLabel="12500" itemValue="12500"></f:selectItem>
                        <f:selectItem itemLabel="15000" itemValue="15000"></f:selectItem>
                        <f:selectItem itemLabel="25000" itemValue="25000"></f:selectItem>
                        <f:selectItem itemLabel="30000" itemValue="30000"></f:selectItem>
                        <f:selectItem itemLabel="40000" itemValue="40000"></f:selectItem>
                        <f:selectItem itemLabel="50000" itemValue="50000"></f:selectItem>
                    </p:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:panelGrid style="position:relative; left:165px" columns="2"
                    cellpadding="2" cellspacing="2">
                    <p:commandButton value="Reset"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 14px; font-weight: normal'></p:commandButton>
                    <p:commandButton id="btnSubmit" value="Submit" type="submit"
                        partialSubmit="true" process="statemenu,dist,@this"
                        actionListener="#{DropDown.setVisiblity}"
                        action="#{DropDown.getValues}" title="Submit" 
                        update="@all"
                        ajax="true"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",  "Hoefler Text", Garamond, "Times New Roman", serif; font-size: 14px; font-weight: normal'>
                    </p:commandButton>
                </h:panelGrid>
            </p:tab>
            <p:tab title="Spec">
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Specification Number :" />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:inputText style="height:20px;width:300px;"></p:inputText>
                </h:panelGrid>
                <br />
                <h:panelGrid columns="2" cellpadding="2" cellspacing="2">
                    <p:outputLabel value="Scale/GSD " />
                    <p:outputLabel value="*" style='color:red;' />
                </h:panelGrid>
                <h:panelGrid>
                    <p:selectOneMenu tabindex="1" style="height:25px;widht:auto;">
                        <f:selectItem itemLabel="--  ALL  --" itemValue="all"></f:selectItem>
                        <f:selectItem itemLabel="5000" itemValue="5000"></f:selectItem>
                        <f:selectItem itemLabel="6000" itemValue="6000"></f:selectItem>
                        <f:selectItem itemLabel="8000" itemValue="8000"></f:selectItem>
                        <f:selectItem itemLabel="10000" itemValue="10000"></f:selectItem>
                        <f:selectItem itemLabel="12500" itemValue="12500"></f:selectItem>
                        <f:selectItem itemLabel="15000" itemValue="15000"></f:selectItem>
                        <f:selectItem itemLabel="25000" itemValue="25000"></f:selectItem>
                        <f:selectItem itemLabel="30000" itemValue="30000"></f:selectItem>
                        <f:selectItem itemLabel="40000" itemValue="40000"></f:selectItem>
                        <f:selectItem itemLabel="50000" itemValue="50000"></f:selectItem>
                    </p:selectOneMenu>
                </h:panelGrid>
                <br />
                <br />
                <h:panelGrid style="position:relative; left:165px" columns="2"
                    cellpadding="2" cellspacing="2">
                    <p:commandButton value="Reset"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                    <p:commandButton value="Submit"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;;
    font-size: 13px; font-weight: normal'></p:commandButton>
                </h:panelGrid>
            </p:tab>
        </p:tabView>


        <!--The tab to Display the Complete Meta data of the sheet selected  -->
        <p:tabView id="tabs" scrollable="true" orientation="top"
            styleClass="tabs" style="position:absolute; top:240px;">
            <p:tab title="Meta Data">

                <h:panelGrid id="MapDetails">

                    <h:panelGrid columns="2" cellpadding="2" cellspacing="5"
                        style="position:relative;left:5px;top:50px">
                        <p:outputLabel value="Sheet No :   " style="font:serif"></p:outputLabel>
                        <p:outputLabel value="#{DataTable.selectedSheet.sheet_no}"></p:outputLabel>
                        <p:outputLabel value="Surveyed year :    "></p:outputLabel>
                        <p:outputLabel value="--"></p:outputLabel>
                        <p:outputLabel value="Publication Year :  "></p:outputLabel>
                        <p:outputLabel value="--"></p:outputLabel>
                        <p:outputLabel value="Map Projection:   "></p:outputLabel>
                        <p:outputLabel value="--"></p:outputLabel>
                        <p:outputLabel value="Map Datum :    "></p:outputLabel>
                        <p:outputLabel value="--"></p:outputLabel>
                        <p:outputLabel value="Place  :   "></p:outputLabel>
                        <p:outputLabel value="--"></p:outputLabel>
                    </h:panelGrid>
                    <h:panelGrid>
                        <h:panelGrid style="position:relative;left:-110px;top:-170px">
                            <div
                                style="position: absolute; top: 95px; left: 20px; border-bottom-style: solid; border-bottom-width: thin; border-top-style: solid; border-top-color: #000000; height: 104px; width: 202px; bottom: auto; left: 414px; right: auto; border-bottom-color: #000000; border-top-width: thin"></div>
                            <div
                                style="border-left-color: #000000; border-right-color: #000000; border-left-style: dashed; border-right-width: medium; border-right-style: dashed; border-left-width: medium; height: 180px; width: 134px; position: absolute; bottom: auto; left: 450px; right: auto; top: 65px"></div>
                        </h:panelGrid>
                        <p:outputLabel title="North East Corner Longitude"
                            value="#{DataTable.selectedSheet.NE_Corner_Long}"
                            style="position: absolute; bottom: auto; right: 135px; top:75px"></p:outputLabel>
                        <p:outputLabel title="North West Corner Longitude"
                            value="#{DataTable.selectedSheet.NW_Corner_Long}"
                            style="position: absolute; bottom: auto; right: 275px; top: 75px"></p:outputLabel>
                        <p:outputLabel title="North East Corner Latitude"
                            value="#{DataTable.selectedSheet.NE_Corner_Lat}"
                            style="position: absolute; bottom: auto; right: 82px; top: 123px"></p:outputLabel>
                        <p:outputLabel title="South East Corner Latitude"
                            value="#{DataTable.selectedSheet.SE_Corner_Lat}"
                            style="position: absolute; bottom: auto; right: 82px; top: 228px"></p:outputLabel>
                        <p:outputLabel title="North West Corner Latitude"
                            value="#{DataTable.selectedSheet.NW_Corner_Lat}"
                            style="position: absolute; bottom: auto; right: 330px; top: 123px"></p:outputLabel>
                        <p:outputLabel title="South West Corner Latitude"
                            value="#{DataTable.selectedSheet.SW_Corner_Lat}"
                            style="position: absolute; bottom: auto; right: 330px; top: 228px"></p:outputLabel>
                        <p:outputLabel title="South East Corner Longitude"
                            value="#{DataTable.selectedSheet.SE_Corner_Long}"
                            style="position: absolute; bottom: auto; right: 135px; top: 290px"></p:outputLabel>
                        <p:outputLabel title="Sorth West Corner Longitude"
                            value="#{DataTable.selectedSheet.SW_Corner_Long}"
                            style="position: absolute; bottom: auto; right: 275px; top: 290px"></p:outputLabel>
                        <h:panelGrid columns="2" cellpadding="3" cellspacing="5"
                            style="postion:absolute;margin-left:300px;margin-top:85px">
                            <p:outputLabel value="State :   "></p:outputLabel>
                            <p:outputLabel value="#{DataTable.selectedSheet.state_cd}"></p:outputLabel>
                            <p:outputLabel value="District :   "></p:outputLabel>
                            <p:outputLabel value="#{DataTable.selectedSheet.district_cd}"></p:outputLabel>
                        </h:panelGrid>
                    </h:panelGrid>
                </h:panelGrid>
            </p:tab>
        </p:tabView>


        <h:panelGrid id="render" style="margin-top:200px;">


            <!-- The Datatable -->
            <p:dataTable id="disptable" value="#{DataTable.dataTable}"
                var="table" lazy="true" rowKey="#{table.sheet_no}"
                selectionMode="single" selection="#{DataTable.selectedSheet}"
                scrollable="true" scrollHeight="115" rendered="#{DataTable.loaded}"
                style="widht:auto ; margin-left:420px;margin-right:30px ;box-shadow: 10px 10px 25px #888888;"
                widgetVar="tabl" emptyMessage="No Records to display.">

                <p:column headerText="Sheet Number" style="width:25%">
                    <h:outputLabel value="#{table.sheet_no}"></h:outputLabel>
                </p:column>

                <p:column headerText="State" style="width:25%">
                    <h:outputLabel value="#{table.state_cd}"></h:outputLabel>
                </p:column>

                <p:column headerText="District" style="width:25%">
                    <h:outputLabel value="#{table.district_cd}"></h:outputLabel>
                </p:column>


                <f:facet name="footer">
                    <p:commandButton id="selectButton" title="Show Complete Details"
                        icon="./images/show.png" update=":form:disp"
                        oncomplete="PF('Dialog').show()" process="@this,disptable"
                        style="height:25px;" ajax="true" iconPos="center" />

                    <p:commandButton style="height:25px;" id="addCart"
                        title="Add to Cart" icon="./images/cart.png" global="false" />

                    <p:commandButton style="height:25px;" id="location"
                        update=":form:tabs:MapDetails" process="@this,disptable"
                        title="Show Co-ordinates" icon="./images/cart.png" global="false" />

                </f:facet>
            </p:dataTable>
            <!--The Dialog to display the selected sheet detials  -->
            <p:dialog header="Detail" widgetVar="Dialog" resizable="false"
                id="carDlg" modal="true">

                <h:panelGrid id="disp" columns="2" cellpadding="4" cellspacing="4"
                    style="margin:0 auto;">

                    <f:facet name="header">
                    </f:facet>

                    <h:outputText id="sheet" value="Sheet No:" />
                    <h:outputText value="#{DataTable.selectedSheet.sheet_no}"
                        style="font-weight:bold" />

                    <h:outputText id="state" value="State:" />
                    <h:outputText value="#{DataTable.selectedSheet.state_cd}"
                        style="font-weight:bold" />


                    <h:outputText id="district" value="District:" />
                    <h:outputText value="#{DataTable.selectedSheet.district_cd}"
                        style="font-weight:bold" />

                </h:panelGrid>

            </p:dialog>

            <!-- Panel Grid which display the Filter text -->
            <h:panelGrid id="filter" columns="1" cellpadding="10" cellspacing="2"
                rendered="#{DataTable.filter}"
                style="position:absolute;bottom:15px;right:80px;border: 1px solid #1f497d;box-shadow: 10px 10px 25px #888888;
            height:auto;width:600px;Text-align:center;">
                <p:outputLabel value="Filter your search to get result."></p:outputLabel>
            </h:panelGrid>
        </h:panelGrid>


        <!-- Ajax Status for ajax request -->
        <p:ajaxStatus onstart="PF('statusDialog').show();"
            onsuccess="PF('statusDialog').hide();" />
        <!-- Dialog for ajax Status -->
        <p:dialog modal="true" widgetVar="statusDialog" draggable="false"
            closable="false" maximizable="false" resizable="false"
            header="Searching">
            <p:graphicImage value="/images/loading.gif" />
        </p:dialog>


    </h:form>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

update="distTable"

中缺少commandButton
<p:commandButton id="btnSubmit" value="Submit" 
    partialSubmit="true" process="statemenu,dist,@this"
    actionListener="#{MenuBean.setVisiblity}"
    action="#{MenuBean.getValues}" 
    title="Submit"
    style='font-family: font-family : Baskerville, "Baskerville Old Face",  "Hoefler Text", Garamond, "Times New Roman", serif; font-size: 14px; font-weight: normal'

    update="distTable">
</p:commandButton>

那页很乱。甚至日食拒绝格式化其内容......

多个建议

  • 将您的cssjsimages放入/resources/js/resources/css个文件夹

  • 使用<h:outputStylesheet name="css/menustyles.css" />代替<link href="./css/menustyles.css" rel="stylesheet" type="text/css" />

  • 使用<h:body>代替<body>

  • 如果<f:event type="preRenderView" listener="#{DataTable.init}" />DataTable,则不要使用@ManagedBean,而是使用@PostConstruct

  • 更喜欢传统名称:#{dataTableBean.init}优于#{DataTable.init}

  • 使用<h:graphicImage name="images/img.gif" />代替<img src="images\img.gif" />

  • 在路径

  • 中使用/代替\
  • <p:growl>作为<h:body><h:form>的直接子女

  • 使用CSS CLASSES !!

调试以这种方式编码的页面几乎是不可能的。

对不起,但我放弃了。