I am trying to set the column widths of my data table. I have looked at this question for an answer How to set width of a p:column in a p:dataTable in PrimeFaces 3.0?.
I am however trying to do something a little bit different. I only want the column to be as wide as the widest element it it is displaying. Most of my data is text.
So for example, it should not look like this
----------------------------- | This is some text | -----------------------------
It should look like this
--------------------- | This is some text | ---------------------
If there are multiple rows, the coulmn should be as large as the widest element.
I always use
<p:dataTable ........ tableStyle="width:auto">
And does what I think you expect your datatable to do.
If you want the table width remain 100%, use
tableStyle="table-layout: auto;"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With