Question

How to set PrimeUI Datatable column width? I have tried this code("http://www.primefaces.org/primeui/datatable.html"), it is working fine but i want to set width of column, please help me
Thx in advanced

Was it helpful?

Solution

Just add width to

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

class?

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;
}

OTHER TIPS

Another option is to use the headerStyle option in the columns array.

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

I haven't been able to find the complete options list for the columns array so if anyone knows where it is please post it!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top