0

Hello i've been exercising in Primefaces and got stuck with the UI , i don't know if I'm weak in CSS or i haven't yet familiarized with the library of primefaces.

enter image description here

IMAGE1

As you can see in the image i wanted to make the separator fully fitted to the panel(IMAGE1). I also wanted to make the header which contains "data" to be not visible. I've already tried to delete the header="data", but it will be not having a top border of the panel(IMAGE2).

IMAGE2 IMAGE2

Here's the code

<ui:composition 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"
                template="/WEB-INF/template.xhtml">
    <ui:define name="content">

        <p:panel style="border:none;">
            <!--        FROM HERE-->  

            <h:form id="form">
                <p:dataGrid var="jab" value="#{homeMBean.listJabatan}" columns="3" layout="grid"
                            rows="12" paginator="true" id="jabatanid"
                            paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                            paginatorPosition="bottom"
                            rowsPerPageTemplate="6,12,16" style="border:none;">

                    <p:panel header="data" style="text-align:center;border-width: 0">
                        <h:panelGrid columns="1" style="width:100%" > 

                            <h:outputText value="#{jab.jabatanAdministrasi}" />
                            <h:outputText value="#{jab.jabatanKppn}" />
                            <h:outputText value="Aktif" rendered="#{jab.active eq true}"/>
                            <h:outputText value="non aktif" rendered="#{jab.active eq false}"/>
                            <p:separator style="margin-left: 0px" />
                        </h:panelGrid>
                    </p:panel>

                </p:dataGrid>

            </h:form>
            <!--TO HERE-->
        </p:panel>
        
                    
    </ui:define>
</ui:composition>
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
PiPio
  • 89
  • 1
  • 3
  • 11

2 Answers2

1

This requires a better knowlegde of CSS development. You need to dig deeper, which would lead you to a style rule set by the theme:

body .ui-panel .ui-panel-content {
  border-top: 0 none;
}

You need to override that style as explained in How do I override default PrimeFaces CSS with custom styles?

Also, if you want to use a headerless panel consistently, I would advise to styleClass the panel to make it reuseable. Or simply use a h:panelGroup or a div with a class, because basically you are after a (rendered) div with a border and some padding.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
0

Just remove header="data"

and replace your style something like that

<p:panel style="text-align:center;border:1px solid #d8d8d8;">

the header will disappear and the border will remain.

Martin Volek
  • 315
  • 2
  • 13