I have a t:dataTable where users can input numbers (a worksheet like in
excel).
I wrote a custom converter in order to convert the Strings to a Number. If
the format is not the one I expect I would like to change the css-styleClass
of the cell(s) with wrong input so the user can see quickly in which cell
the error happened (and additionally I print an error-message on top of the
screen).

      <t:dataTable var="row" value="#{Bean.list}" >
        <t:column>
                <t:inputText value="#{row.value}" converter="myConverter"
                         styleClass="#{StyleBean.style]}" />
        </t:column>
              ...
       </t:dataTable>

My converter works, but I don't know how to change the style of the
input-component. The following code does not work, it changes me the error
class of the whole column!

        public Double getAsObject(FacesContext fc, UIComponent uc, String 
asString)
                        throws ConverterException {
                
                Double doubleValue = null;
                try {
                                  ..... //convert the string to a double
                } catch (Exception e) {
                                     
((HtmlInputText)uc).setStyleClass("errorStyle");
                                       FacesMessage facesMessage = ....
                        throw new ConverterException(facesMessage);
                }
                return doubleValue;
        }

Does anyone know how I can solve this problem?
Any help is appreciated.

Many Thanks
Peter
-- 
View this message in context: 
http://www.nabble.com/t%3AdataTable%3A-how-to-change-css-style-on-single-cells-after-conversion-error--tf4355282.html#a12410633
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to