[英]How to set width and margin of <p:column> in a <p:dataTable> ? primefaces
I'm using PrimeFaces 3.4.2 and I have to use <p:dataTable>
. 我正在使用PrimeFaces 3.4.2,并且必须使用
<p:dataTable>
。 I want fixe the width of the first column to less than 5 px. 我想将第一列的宽度固定为小于5像素。 for that I created a css class :
为此,我创建了一个CSS类:
.myTableFlux td:nth-child(1) {
width: 5px !important;
}
this is my table : 这是我的桌子:
<p:dataTable value="#{bean.listFlux}" var="list" styleClass="myTableFlux">
<p:column headerText="Status" >
<h:graphicImage value="/resources/images/so#{list.i}.jpg" />
</p:column>
<p:column headerText="Nom">
<h:outputText value="#{list.name}" />
</p:column>
</p:dataTable>
the problem is that I can not go below 5 px. 问题是我不能低于5像素。
here is the image that I want to have as a result 这是我想要得到的图像
For me, the width
-Attribute on the p:column
tag works with PrimeFaces 3.4: 对我来说,
p:column
标记上的width
-Attribute适用于PrimeFaces 3.4:
<p:column width="3" headerText="longlong">
<h:outputText value="xyz" />
</p:column>
This code will display like this: 此代码将显示如下:
Edit : Found a solution to style the padding of certain columns: 编辑 :找到了样式某些列的填充样式的解决方案:
<style>
.ui-datatable td:nth-child(1) div.ui-dt-c {
padding: 0 0 0 0 !important;
}
</style>
PrimeFaces can be a little tricky. PrimeFaces可能会有些棘手。 You have to track down where the attribute comes from, and overwrite the specific styleClasses.
您必须跟踪属性的来源,并覆盖特定的styleClasses。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.