Dynamic Datatable column width based on content length

I want the column width to be dynamic based on the length of the content, I made a function that calculates the length of the content ( call()

), but the problem is that the content returns an empty string:

<p:column sortBy="action" rendered="#{configuration.conf2.action}" width="#{cdrMmscRecBean.call(c.action)}"  >
    <f:facet name="header" > 
    <h:outputText value="Action"  />
    </f:facet>
    <h:outputText value="#{c.action}" />
</p:column>

      

c.action returns an empty string.

+3


source to share


1 answer


Very often it is enough to set the style of the data table, for example

<p:dataTable tableStyle="width: auto;">

      



Then you don't need to calculate the column width in a special method, but the table will adjust the column widths based on the content. At least it works for simple cases.

0


source







All Articles