Databinding AccordionPanel

UI Components for JSF
Post Reply
smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

08 Apr 2010, 04:37

Primefaces 2.0.1 drop 118
PostgreSQL 8.4
NetBeans 6.8
JPA
GlassFish

Hi

I have a data model with categories and items - with a 1:M relationship. Each category can have M items. I have generated the basic crud for the same - entity bean and session bean.

As for the UI, I am trying to build a AccordionPanel with each tab representing category and upon expanding the tab the items related to that category would be displayed in a dataTable. I looked at the AccordionPanel documentation there does not seem to be any way to bind the tab text to a backing bean. Has anyone tried this and found how it can be done? I am sure Accordion Panel can be dynamically generated.

Additionally - I am also trying to see if I can bind the the id attribute of the tab to the category code (which is unique) from the category table (bean) and then inherit it to filter the items in the nested dataTable.

Any pointers to documentation or an example for this would be appreciated.

The UI Node tree I see would be something like this

Code: Select all

<h:form>
  <p:accordionPanel id="catalog">
     <!-- tabs are databound to rows in the category table -->
      <p:tab id="<databound:category_code>" title="<databound:category_name>">
          <!-- for each category in the line above grab the category code and filter the rows in the dataTable below -->
          <p:dataTable value="#productController.items" var="product" rows="10" paginator="true">
             <p:column>
                  <f:facet name="header">
                       <h:outputText value="#{bundle.ListProductTitle_name}"/>
                  </f:facet>            
                  <h:outputText value="#{product.name}"/>
             </p:column>
             <p:column>
                  <f:facet name="header">
                       <h:outputText value="#{bundle.ListProductTitle_description}"/>
                  </f:facet>            
                  <h:outputText value="#{product.description}"/>
             </p:column>
          </p:dataTable>
      </p:tab>
  </p:accordionPanel> 
</h:form>
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

08 Apr 2010, 11:26

Title and Id can get a value expression for dynamic values. I have no idea what <databound:category_code> is though.

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

08 Apr 2010, 18:20

Thanks Cagatay.

<databound:category_code> is not a JSF construct. I was merely using it to mean that I would like the id for tab to be bound to category_code and title to be bound to the category_name.

When you say "Title and Id can get a value expression for dynamic values" can we iterate through a collection and have tabs in the accordion rendered?

Also is there anyway to co-relate the category_code from the tab and use that to filter the corresponding items displayed in the dataTable in each tab?
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

tittatty
Posts: 12
Joined: 06 Jun 2010, 23:28

10 Jun 2010, 21:12

Any luck with this? Dynamically creating an accordionpanel?

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

10 Jun 2010, 21:20

No. I was short on time so gave up on that and went to a different Master-detail format.

The new component - TreeTable (http://www.primefaces.org:8080/prime-sh ... eTable.jsf) seems to do what I initially wanted. I plan to move my workaround to a TreeTable implementation.
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests