Is possible to change the color of a content view list based on a value of a metadata?

For example, I would like to have a different colour for all rows having the same version number or contributor in the list. How could I customise the style (css) of the content view list?

0 votes

1 answers

1634 views

ANSWER

Hello,

Before writing a CSS rule to customize a table row, depending on a specific value displayed in it, you need to have a class generated each time this value is rendered.

There is no class like that generated in the tables by default.

10/10/2012

Is it possible to add a css class on the table/tr element? How do write a customize CSS rule based on a value? Thanks.
10/10/2012



Hi,

Style class on table/tr element is hardcoded right now (and only handles dataRowEven/dataRowOdd classes), so that is not easily configurable.

You can look into the layout template used for the listing rendering to see how all this is done here: https://github.com/nuxeo/nuxeo-jsf/blob/master/nuxeo-platform-webapp-base/src/main/resources/web/nuxeo.war/layouts/layout_listing_ajax_template.xhtml

If you'd like to retrieve the current item here, it'll probably be available by expression “#{value.data} since each item is a PageSelection here.

There are other kinds of customizations available, but not directly on the tr element. For instance you can control the style class of a widget within each td, and you can also set a style class on each column (this is doable in Studio, but obviously in this case you need a static class, it cannot depend on the document)

1 votes