开发者

How to provide a minimum width for rich:orderingList control

开发者 https://www.devze.com 2023-01-18 13:49 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号