aspose file tools*
The moose likes JSF and the fly likes data table list in a list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "data table list in a list" Watch "data table list in a list" New topic
Author

data table list in a list

Yasir Qureshi
Greenhorn

Joined: Apr 26, 2006
Posts: 24
I am using datatable to display a list of object say A that has another list of object lets say B in it, This is how my object looks:

Class A{
private String name;
private B[] b;
}

How can I display such an object in datatable? I am out of clue how to display List of Object B.

Thanks.
Harish Govind
Greenhorn

Joined: Nov 06, 2008
Posts: 8
Hey Yasir could you please more specific on your requirement. Do you want to display total list A as a datamodel (in which list b also exists) or just display list A elements excluding list B from it and show list B as datamodel whenever any action is done on user.


Harish Govind
Yasir Qureshi
Greenhorn

Joined: Apr 26, 2006
Posts: 24
I want to display list A and also list B which is contained by list A, in the same data table.
Marius Snyman
Greenhorn

Joined: May 04, 2006
Posts: 14
Originally posted by Yasir Qureshi:
I want to display list A and also list B which is contained by list A, in the same data table.


In you backing add two HTMLDatatables
private HtmlDataTable dataTableA;
private HtmlDataTable dataTableB;
private List ListA ;
private List ListB ;


On your web page link:
<h:dataTable id="itemsA" bindings="#{bbean.dataTableA}" value="bbean.ListA">
<h:dataTable id="itemsB" bindings="#{bbean.dataTableB}" value="bbean.ListB" rendered="false">

Add the entries of ListA to dataTableA
Add A commandLink to a column in dataTableA which calls a method in the backing bean:

ex:
<h:commandLink action="#{bbean.selectDetail}">
<hutputText value="Show Detail"/>
</h:commandLink>

in the backin bean method set the rendering for tableB to true
public void selectDetail(){
ListB = ListA.ListBData
ListB.setRendered(true)
}

You will then display your data as a sort of Master/Detail record on the web page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data table list in a list
 
Similar Threads
rendering each child t:tree node in seperate column in panel grid
Dynamic datatable in jsf
Mixing dataTable with selectOneRadio
how to display list of objects in turn each object contains one more list using jsf2.0 datatable?
Error while displaying validation message for inputText generated dynamically in rich:dataTable