1 Reply Latest reply on Aug 28, 2007 5:54 AM by tjakopec

    How to remove the dataTable column

      hai everyone

      this is my table structure

      
      Table_Products
      product_category property
      
      cell phone messaging
      cell phone camera
      cell phone Entertainment
      Car fuel
      Car price
      
      Table_car
      
      id fuel price
      m55 petrol 35000
      c56 diesel 50000
      
      Table_Cellphone
      
      id messaging camera Entertainment
      2288 sms video capture FM
      4466 email zoom camera games
      


      i need to display the all products information under one category at a time.
      The datatable should be column wise and completely dynamic
      if i am going to display the car category i have two list for display the dataTable
      one from Table_products and another one from Table_Car

      this is my view part

      <rich:dataTable var="product" value="#{table_products_list}">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column>
       <h:outputText value="property" />
       </rich:column>
       <c:forEach items="#{car_list}" var="car">
       <rich:column>
       <h:panelGroup>
       <h:outputText value="#{car .id}"/>  
       <h:commandLink value="Remove" action="#{bean.removeColumn}" /> </h:panelGroup>
       </rich:column>
       </c:forEach>
       </rich:columnGroup>
       </f:facet>
       <rich:column>
       <h:outputText value="#{product.property}" />
       </rich:column>
      
       <c:forEach items="#{car_list}" var="car">
       <rich:column>
      
       <h:outputText value="#{car.returnValue(product.property)}"/>
      
       </rich:column>
       </c:forEach>
      </rich:dataTable>
      


      the DB have two entries in Table_car. so the dataTable shows three columens . one for showing properties and another two for dispaly two different entries in the DB.

      here when i click remove link on any column i need to remove that particular column. i dont know how to do this
      it is possible in Richface
      please anyone help me

      by
      thiagu.m

        • 1. Re: How to remove the dataTable column
          tjakopec

          try something like this

          <c:forEach items="#{car_list}" var="car">
           <rich:column rendered="#{car.rendered}">
           <h:panelGroup>
           <h:outputText value="#{car .id}"/>
          
          <h:commandLink value="Remove" action="#{bean.removeColumn}" />
           </h:panelGroup>
           </rich:column>
           </c:forEach>
          


          even thou I am not so sure that datatable is designet for this kind of work. Datatable shows properties of same type (ex. Car (id,type,motor))