I was trying to override the styles of the P:datatable using the below code. The styles are applied fine on the row elements. But when I apply the style for the column headers, the style is applied only to the headertext alone and not to the entire column.
The css style code which Im using to override the datatable is
Code: Select all
#order-table.mystyle {
border-style:groove;
}
#order-table.mystyle th{
text-align:center;
background-color: #C6C3C6;
padding:12px;
}
#order-table.mystyle td{
ttext-align:center;
background-color:#9CD3F7;
border-top:1px solid;
}
#order-table.mystyle td{
text-align:center;
background-color:#9CD3F7;
border-top:1px solid;
}
Code for datatable is below
Code: Select all
<h:head>
<title>Insert title here</title>
<h:outputStylesheet library="css" name="table-style.css" />
</h:head>
<h:body>
<h1 id="tableID">JSF 2 dataTable example</h1>
<p:dataTable id="order-table" value="#{order.orderList}" style="width:100%; font-family:Arial; font-size: 12px;"
styleClass="mystyle" rowStyleClass="order-table-odd-row,order-table-even-row" var="o">
<p:column id="col1">
<f:facet name="header" >
Order No
</f:facet>
#{o.orderNo}
</p:column>
<p:column id="col2">
<f:facet name="header">Product Name</f:facet>
#{o.productName}
</p:column>
<p:column id="col3">
<f:facet name="header">Price</f:facet>
#{o.price}
</p:column>
<p:column id="col4">
<f:facet name="header">Quantity</f:facet>
#{o.qty}
</p:column>
</p:dataTable>
</h:body>