Is it possible to expand/collapse a subtable in a datatable? My subtable contains info relating to the row above it and I would like to show/hide onclick of an image. Just wondering how I'd go about it?
This is what I'm currently using:
<rich:dataTable value="#{accountsBean.musicboxes}" var="currentMusicBox">
<rich:column>
<h:graphicImage id="expand" value="../AccountsForms/images/details_open.png" onclick="toggleNotes(this);" />
<rich:column><h:outputText value="#{currentMusicBox.name}" /></rich:column>
<rich:column><h:outputText value="#{currentMusicBox.username}" /></rich:column>
<rich:column><h:outputText value="#{currentMusicBox.password}" /></rich:column>
<rich:column><h:outputText value="#{currentMusicBox.location}" /></rich:column>
<rich:dataTable id="notesTable" value="#{currentMusicBox.notes}" var="currentNote" style="display: none;">
<rich:column><h:outputText value="#{currentNote.body}" /></rich:column>
<rich:column><h:outputText value="#{currentNote.dateAdded}" /></rich:column>
<rich:column><h:outputText value="#{currentNote.note_type}" /></rich:column>
</rich:dataTable>
</rich:column>
</rich:dataTable>
The problem is that only the first entry in my table displays ok. It is in the table and I can toggle image for notes. The rest of the entries are just one after each other (outside table with no formatting. Clicking on the image will open a table with related notes formatted properly