I have a datatable with Items in it.

One column in the datatable contains a link to show SubItems of an Item.

These SubItems have to be displayed also in the datatable below the clicked Item in additional rows.

The row (or the columns) of these SubItems have special css classes for visualization. The number of columns is the same for Items and SubItems.

Moreover the rows (Items and SubItems) contain checkboxes.

 

The datatable is bound to a PagedListDataModel in the BackingBean as mentioned in the WIKI.

This dataModel contains a List of Items and I have to display e.g. 20 Items on each page, regardless of SubItems.

The class Item contains a method getSubItems().

 

What is now the best approach to visualize these SubItems in the datatable?

I think I have just to output additional table rows.

 

a) Can I achieve this with a custom TableRenderer?

The HtmlTableRendererBase contains a method afterRow(FacesContext facescontext, UIData uidata).

Can I overwrite this method and place my logic there?

uiData.getRowData() returns the last rendered Item.

How can I now render additional rows with columns (and their children) for these SubItems?

 

b) Or would it be easier to manipulate the dataModel and add the SubItems to the DataModel?

I am not sure how to display the right number of Items on a page in this case if the DataModel contains both, Items and SubItems?

 

 

Any help is highly appreciated

Michael

Reply via email to