We use rich:orderingList with the following attributes listHeight="auto" listWidth="auto", this causes it to aut开发者_JAVA技巧o re-size and if there are smaller strings within the list, the list width is very small. We would prefer to have a minimum size for smaller strings and should change to auto for larger strings. How do we achieve this?
You can set the width each column separately and with EL expression set width either fixed size or auto.
So if for example your Item value is of type String
<rich:orderingList value="#{bean.simpleItems}" var="item" selection="#{bean.selection}" controlsType="button">
<rich:column width="#{item.name.length > 100 ? 'auto' : '100px'}">
<f:facet name="header">
<h:outputText value="Car Name" />
</f:facet>
<h:outputText value="#{item.name}" />
</rich:column>
</rich:orderingList>
Another option is through columnClasses
property of rich:orderingList. You can define in the backing bean the CSS classes considering the maximum width of each String, and using it as ELExperssion: columnClasses="#{myBean.columnWidth}"
精彩评论