Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF Datatable row data - Expand/Collapse

843844Jun 23 2009 — edited Jun 23 2009
Hi,

I just started learning the JSF concepts. I read articles by BalusC which are very clear and easily understandable. Thanks to BalusC.

I have a requirement to implement expand and collapse data using JSF datatable. The data comes from the backing bean is in the form of java.util.List which contains StudentInfo. I will have to display following data from the list.

*{color:#0000ff}name {color}(this is to be displayed a link), firstname, lastname, dob*

I am able to display the data in a nice formatted table using h:datatable. My main hurdle is to display an expanded info when the name link is clicked. The expanded info should be displayed below the row spanning all columns. The additional info being the comments, instructions whic are the part of the row data. Here is the code describing the StudentInfo.

Appreciate if someone help me with suggestions. Very helpful if any sample code is avaialble.

Regards,

Smitha

public class StudentInfo {

//Following fields to be shown in row data
private String name;
private String firstname;
private String lastname;
private String dob;

//Following fields to be shown in expanded form
private String comments;
private String instructions;

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getDob() {
return dob;
}
public void setDob(String dob) {
this.dob = dob;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getInstructions() {
return instructions;
}
public void setInstructions(String instructions) {
this.instructions = instructions;
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2009
Added on Jun 23 2009
2 comments
643 views