如何设置PrimeUI Datatable列宽

时间:2014-01-06 09:48:27

标签: javascript css prime-ui

如何设置PrimeUI Datatable列宽? 我试过这段代码(“http://www.primefaces.org/primeui/datatable.html”),它工作正常,但我想设置列的宽度,请帮帮我 Thx in advanced

2 个答案:

答案 0 :(得分:1)

只需将宽度添加到

  

.pui-datatable thead th,.pui-datatable tbody td,.pui-datatable tfoot td

类?

Edit:

.pui-datatable thead th:nth-child(1),
.pui-datatable tbody td:nth-child(1),
.pui-datatable tfoot td:nth-child(1) {
    width: 50px;
}

.pui-datatable thead th:nth-child(2),
.pui-datatable tbody td:nth-child(2),
.pui-datatable tfoot td:nth-child(2) {
    width: 100px;
}

答案 1 :(得分:1)

另一个选择是使用columns数组中的headerStyle选项。

{field:'view',headerText:'View',content:createEditButton, headerStyle :“width:8%”},

我无法找到列数组的完整选项列表,所以如果有人知道它在哪里,请发布它!