1 Reply Latest reply on Nov 11, 2011 10:19 AM by Bill Papas

    inplaceInput with initial value style problem

    Bill Papas Newbie

      Hi,

       

      I have a datatable with an inplaceInput for each row. For the existing rows there is already a value and for newly added rows the value is empty and the defaultLabel is displayed. Now, if I edit an existing row's value and the new value entered is the same with the initial one, the class rf-ii-dflt-lbl is applied (the defaultLabel's one) and the text is colored gray, although the value is not empty and it is not the defaultLabel that is displayed. Is this a bug? The same happens either if I just focus/unfocus the inplaceInput or actually type the value.

       

      I tried to solve this by rerendering the inplaceInput on blur event, but then the changedClass is lost too. I am using RichFaces 4.1.0M4.

       

      Thanks.

        • 1. Re: inplaceInput with initial value style problem
          Bill Papas Newbie

          Ok, I managed to make this work by editing InplaceInputRenderer.java

           

          Changed line 143:

          String defaultLabel  =  (((inplaceValue != null) && !isEqual(inplaceValue.length(),0)) ? inplaceValue : "\u00A0\u00A0\u00A0");

          to:

          String defaultLabel  =  ((org.richfaces.component.InplaceComponent) component).getDefaultLabel();

          if (defaultLabel == null || defaultLabel.length() == 0) {

             defaultLabel = "\u00A0\u00A0\u00A0";

          }

           

          and line 196:

          Object text = defaultLabel;

          to:

          Object text = (inplaceValue != null && inplaceValue.length() > 0) ? inplaceValue : defaultLabel;

           

          Hope this helps.