将styleClass应用于datatable列上的inputText时的问题

问题描述:

CSS:

.sample {
   background: red;
}

XHTML

<p:inputText id="inputTxtOnForm" value="hi" styleClass="sample"/>

<p:column id="articleDescription" headerText="Article Description"
               filterBy="#{article.description}" filterMatchMode="startsWith">
               <p:inputText id="inputTxtOnDataTable" value="#{article.description}"
                  styleClass="sample" />
 </p:column>

inputTxtOnForm直接放置在表单上. inputTxtOnDataTable放在数据表的列上.

inputTxtOnForm is placed on a form directly. inputTxtOnDataTable is placed on a column of a datatable.

正在应用具有id="inputTxtOnForm"inputText上的styleClass.但是,styleClass不会应用于具有id="inputTxtOnDataTable"inputText.在后一种情况下,primefaces的themes.css属性不会被覆盖.

The styleClass on the inputText having id="inputTxtOnForm" is getting applied. But, styleClass is not getting applied on the inputText having id="inputTxtOnDataTable". The properties of primefaces' themes.css are not getting over-ridden in the latter case.

这是一个已知的错误吗?有没有解决的办法.

Is it a known bug ? Is there any workaround for the same.

.sample {
   background: red  !important;
}

为我工作.可能在primefaces的css中将背景标记为重要.

worked for me. Probably, the background is marked as important in primefaces' css.