如何对齐这个selectOneMenu

时间:2015-11-02 20:25:02

标签: primefaces

如何对齐此selectOneMenu? 我在其他页面遇到同样的问题。

image

代码:

<!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:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:namespace="http://java.sun.com/jsf/composite/namespace"
    xmlns:sec="http://www.springframework.org/security/facelets/tags">
<!-- 
        Replace path to template, title, header and body
        with actual data.
     -->
<ui:composition template="Template.xhtml">
    <ui:define name="content">
        <div class="content_wrapper">
            <div class="content">
                <sec:ifAnyGranted roles="ROLE_ADMINISTRADOR,ROLE_USUARIO,ROLE_GERENCIADOR">

                    <h:form id="formGrid">
                    Data Inicial: <p:calendar id="popup" value="#{relatorioHistoricoMB.dataInicial}" />
                    Data Final: <p:calendar id="popup2" value="#{relatorioHistoricoMB.dataFinal}" />
                    <p:selectOneMenu value="#{relatorioHistoricoMB.reservatorio.idReservatorio}"
                        style="width:170px" required="true"
                        requiredMessage="Selecione algum.">
                        <f:selectItem itemLabel="Selecione o Reservatório" itemValue="0" />
                        <f:selectItems value="#{relatorioHistoricoMB.listaReservatorio}"
                            var="reservatorio" itemLabel="#{reservatorio.nomeReservatorio}"
                            itemValue="#{reservatorio.idReservatorio}" />
                    </p:selectOneMenu>
                    <p:commandButton value="Gerar relatório" update="formGrid"
                        actionListener="#{relatorioHistoricoMB.executar}" />

                        <p:dataTable id="Grid" var="historico"
                            value="#{HistoricoBean.listaHistorico}"
                            selection="#{HistoricoBean.historico}" selectionMode="single"
                            rowKey="#{historico.idHistorico}" paginator="true" rows="5">
                            <f:facet name="header">
                                <h:outputText value="Historico" />
                            </f:facet>
                            <p:column headerText="Reservatorio">
                                <f:facet name="header">
                                    <h:outputText value="Reservatorio" />
                                </f:facet>
                                <h:outputText value="#{historico.reservatorio.nomeReservatorio}" />
                            </p:column>

                            <p:column headerText="Bomba">
                                <f:facet name="header">
                                    <h:outputText value="Bomba" />
                                </f:facet>
                                <h:outputText value="#{historico.bomba.nomeBomba}" />

                            </p:column>

                            <p:column headerText="Data">
                                <f:facet name="header">
                                    <h:outputText value="Data" />
                                </f:facet>
                                <h:outputText value="#{historico.dataHistorico}" />
                            </p:column>

                            <p:column headerText="Evento">
                                <f:facet name="header">
                                    <h:outputText value="Evento" />
                                </f:facet>
                                <h:outputText value="#{historico.novoStatusHistorico}" />
                            </p:column>

                        </p:dataTable>
                    </h:form>
                </sec:ifAnyGranted>
            </div>
        </div>
    </ui:define>
</ui:composition>
</html>

1 个答案:

答案 0 :(得分:0)

您可以尝试将元素放入p:panelGrid中 http://www.primefaces.org/showcase/ui/panel/panelGrid.xhtml

但是primefaces数据表可以使用过滤器:
http://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml