简体   繁体   中英

Is there a way to apply styles to columns in a p:selectManyMenu?

Is there a way to apply styles to columns in ap:selectManyMenu?

<!-- Cut down version of the code -->
<p:selectManyMenu id="myMenu" value="#{myBean.myEntries}" 
        var="ent" converter="#{EntriesConverter}"
        showCheckbox="true" styleClass="valign-middle mapMenu" >
    <f:selectItems value="#{myBean.entryList}" var="entry" itemValue="#{entry}" />
    <p:column styleClass="css_id">#{entry.id}</p:column>
    <p:column styleClass="css_name">#{entry.name}</p:column>
</p:selectManyMenu>

The generated code does not include the css_id and css_name and so I can't see a good way of applying css styling to the columns :(

Am I missing something or is it not possible? What are the alternatives?

I found a way to control the column width in a rather roundabout way:

/* MyStylesheet.css */

.mapMenu 
{
  height: 200px;
  width: inherit ! important;
}
.mapMenu table 
{
  table-layout: fixed;
}
.mapMenu table tbody tr td:nth-of-type(1) 
{
  width: 20px;
}
.mapMenu table tbody tr td:nth-of-type(2) 
{
  width: 50px;
}

It's probably not the best way of doing it, but until an alternative arises it'll have to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM