6 Replies Latest reply on Oct 6, 2008 8:41 AM by Andreas Hoehmann

    <rich:datGrid> ignores c:if - URGENT

    Saravanan Vijayappan Newbie

      Hello,

      I do use c:if jstl tag inside of rich:dataGrid in my application. Looks like, c:if jstl tag is not executed within rich:dataGrid tag, I have added test jsf code below which shows the test cases of forEach and rich:dataGrid. In my test, c:if test is not executed in rich:dataGrid, but it perfectly works wthin forEach

      Please see my code below:-

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jstl/core">

      <ui:composition>

      <a4j:form>

      <c:forEach items="#{itemsBean.itemsList}" var="item">
      <h:outputText value="Item:"/>
      <c:if test="#{item.listprice!=null}">
      <h:outputText value="#{item.heading}"/>,
      <h:outputText value="#{item.listprice}"/>

      </c:if>
      </c:forEach>

      <rich:dataGrid value="#{itemsBean.itemsList}" var="gitem" columns="1" elements="4">
      <h:outputText value="Item:"/>
      <c:if test="#{gitem.listprice!=null}">
      <h:outputText value="#{gitem.heading}"/>,
      <h:outputText value="#{gitem.listprice}"/>

      </c:if>
      <f:facet name="footer">
      <rich:datascroller></rich:datascroller>
      </f:facet>
      </rich:dataGrid>
      </a4j:form>
      </ui:composition>



      OUTPUT
      =====

      The below output is generated by forEach tag

      Item:APC Back-UPS 750G Surge Protector,99.99
      Item:TomTom One 130S Portable GPS,249.99
      Item:Apple - iMac 2.8GHz with 24" Display,1799.99
      Item:Navigon 5100 - Portable GPS System with Reality View - Built in US Maps - Free Real-Time Traffic - Factory Refurbished,300.0
      Item:Canon Powershot SD950 IS 12 Megapixel Digital Camera ,499.99
      Item:SanDisk 8GB Cruzer Micro U3 USB2.0 Flash Drive,79.99
      Item:Lenovo ThinkPad X61 Tablet PC - Centrino Duo - Intel Core 2 Duo L7500 1.6GHz - 12.1" SXGA+ - 2GB DDR2 SDRAM - 120GB - DVD-Writer (DVDR/RW) - Gigabit Ethernet, Wi-Fi, Bluetooth - Windows Vista Business - Black - 776796U,999.0
      Item:Toshiba Satellite A205-S5841 Notebook - Intel Pentium Dual-Core T2370 1.73GHz - 15.4" WXGA - 2GB DDR2 SDRAM - 160GB - DVD-Writer (DVD-RAM /R/RW) - Fast Ethernet, Wi-Fi - Windows Vista Home Premium - Onyx Blue Metallic,749.99
      Item:Item:Toshiba Fusion Satellite A305-S6829 15.4" Widescreen Laptop,1000.0

      The below output Generated by dataGrid

      item:
      item:
      item:
      item:
      item:
      item:
      item:
      item:
      item:
      item:

      You can see that c:if tag is actually not evaluated within rich:dataGrid.

      Can anyone please help me how can this be fixed?

      Thanks