Search code examples
jsf-2tomahawk

Using Tomahawk dataTable and varDetailToggler, I want a fixed header with scrollable rows


I've looked at other solutions for this problem, but they all seem to suggest using rich:scollableDataTable or rich:extendedDataTable. Neither of those provide the varDetailToggler functionality.

I've also seen a solution which splits the header into a separate table. Unfortunately, this solution breaks the use of varDetailToggler as well. The header contains buttons for ExpandAll and CollapseAll for the details.

Is there a Tomahawk solution?


Solution

  • Here's my solution:

            <t:dataTable id="data" var="phen"
                value="#{workflowLookup.dataModel}" 
                binding="#{workflowLookup.table}" 
                varDetailToggler="detailToggler">
                <f:facet name="header">
                    <h:commandButton
                        id="expand-all-button"
                        action="#{detailToggler.expandAllDetails}"
                        value="Expand All" />                                  
                    <h:commandButton
                        id="collapse-all-button"
                        action="#{workflowLookup.collapseAllDetails}" 
                        value="Collapse All" />
                </f:facet>
                ... (rest of table)
    
            </t:dataTable>