1 Reply Latest reply on Apr 18, 2011 12:32 PM by kimda

    Making a rich:column dynamic using rendered

    kimda
      Hi,

      I am trying to make rich column dynamic and trying to rendered property.
      Plz see the below code.

      entry.when is not null for this line
      '<h:outputText value="#{e:formatAge(thisPerson.personDob, entry.when)}" />'


      however, "entry.when " is null for this line
      '<rich:column rendered="#{e:getAgeInMonthsAtDate(thisPerson.personDob, entry.when)  lt  60}">'

      and I get this error.
      javax.el.ELException: /META-INF/facelets/print.xhtml @136,119
      rendered="#{e:getAgeInMonthsAtDate(thisPerson.personDob, entry.when) lt 60}":
      java.lang.NullPointerException

      I check this func and see this:

      Caused by: java.lang.NullPointerException
      at java.util.Calendar.setTime(Calendar.java:1075)
      at diana.ehr.el.StringFunctions.getAgeInMonthsAtDate(StringFunctions.java:152)

      so, I know "entry.when " is null for rendered property.

      I know entry.when is not null always and this happens even when size of growthParametersPrintList is 1.



      thanks in advance....

      ++++++++++++++++


      `

      <rich:dataTable rendered="#{growthParametersPrintList.size ne 0}"
                                  id="growthParametersList"
                                  rowKeyVar="rowKey"
                                  value="#{growthParametersPrintList}"
                                  var="entry">             
                                      <f:facet name="header">
                                          <rich:columnGroup>
                                            
                                        
                                          ...

                                            
                                          </rich:columnGroup>
                                      </f:facet>                       
                                    
                                      <rich:column>
                                              <!-- works ok , causing NullPointerException (entry.when is null)-->
                                              <h:outputText value="#{e:formatAge(thisPerson.personDob, entry.when)}" />
                                      </rich:column>
                                           .....
                                    
                                                  <!-- doesn't work  -->
                                       <rich:column rendered="#{e:getAgeInMonthsAtDate(thisPerson.personDob, entry.when)  lt  60}">
                                          <h:outputText value="#{entry.wtHtPercentile}" />
                                      </rich:column>
                                     
                                    
                                     
                                   
                                     
                                     
                                 
                              </rich:dataTable>
      `

        • 1. Re: Making a rich:column dynamic using rendered
          kimda
          Sorry, it should be this...

          <!-- works ok )-->
            <h:outputText value="#{e:formatAge(thisPerson.personDob, entry.when)}" />
              </rich:column>
             .....
                                                                                    
          <!-- doesn't work , causing NullPointerException (entry.when is null -->
                                          
          <rich:column rendered="#{e:getAgeInMonthsAtDate(thisPerson.personDob, entry.when) lt 60}">
                                             
               <h:outputText value="#{entry.wtHtPercentile}" />
                                         
          </rich:column>