One of our projects, we had to display a "tree type" table with different datamodel for children. To solve this, I choose a normal af:table with a detailStamp facet with a List view inside it.
But pretty soon, I ran into an issue of correctly identifying the "disclosed" rows. Since my table's datasource is a bean, not ADF managed datacontrol.
So I solved it using a discloseListener on the af:table.
Full Application is on GitHub : https://github.com/sohamda/Row-Disclose-Example/
Classes invloved :
1. POJO.java : dataProvider class for af:table
2. SubPOJO.java : dataProvider for the list view inside detailStamp of the table.
3. TableBean.java : provides the methods for populating af:table and af:listView. Also has a discloseListener method to correctly populate the listView datasource.
af:table definition :
TableBean.tableRowDiscloseListener() :
public void tableRowDiscloseListener(RowDisclosureEvent rowDisclosureEvent) {
RowKeySet disclosedSet = rowDisclosureEvent.getAddedSet();
Iterator itr = disclosedSet.iterator();
while(itr.hasNext()) {
int rowKey = (Integer) itr.next();
POJO disclosedObject = (POJO) getTable().getRowData(rowKey);
this.disclosedTableRows = disclosedObject.getAddresses();
}
}
When it runs :
But pretty soon, I ran into an issue of correctly identifying the "disclosed" rows. Since my table's datasource is a bean, not ADF managed datacontrol.
So I solved it using a discloseListener on the af:table.
Full Application is on GitHub : https://github.com/sohamda/Row-Disclose-Example/
Classes invloved :
1. POJO.java : dataProvider class for af:table
2. SubPOJO.java : dataProvider for the list view inside detailStamp of the table.
3. TableBean.java : provides the methods for populating af:table and af:listView. Also has a discloseListener method to correctly populate the listView datasource.
af:table definition :
TableBean.tableRowDiscloseListener() :
public void tableRowDiscloseListener(RowDisclosureEvent rowDisclosureEvent) {
RowKeySet disclosedSet = rowDisclosureEvent.getAddedSet();
Iterator itr = disclosedSet.iterator();
while(itr.hasNext()) {
int rowKey = (Integer) itr.next();
POJO disclosedObject = (POJO) getTable().getRowData(rowKey);
this.disclosedTableRows = disclosedObject.getAddresses();
}
}
When it runs :
Comments
Post a Comment