• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nested h:datatable question

 
Chad Foor
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've got the following situation - I've got an <h:dataTable> with 4 columns
rendering an ArrayList of values in my JSP. (This works great.)

What I want to do -
In the first column, I've set up a nested <h:dataTable> that renders exactly 2 columns, which gets exposed. I've already got it set up to where
I can get the inner datatable to show up. However, what I'd like to do is have that inner table be expanded (span) across the set of columns for that particular row...

Code looks like this in the JSP:

<h:dataTable columnClasses="list-left, list-left, list-left, list-left"
headerClass="list-header"
rowClasses="list-row-even, list-row-odd"
styleClass="list-background"
id="table"
rendered="#{form.renderGeneralResults}"
value="#{form.list}"
var="result">
<h:column>
<f:facet name="header">
<hutputText value="Name"/>
</f:facet>
<h:commandLink value="#{result.entityName}"
actionListener="#{form.expandRow}"
rendered="#{result.renderGeneralToggle}"
title="#{result.identity}"/>
<%--
now for the nested table...
--%>

<h:dataTable rendered="#{result.renderExactToggle}"
value="#{result.exactResults}"
var="expand">

<h:column>
<f:facet name="header">
<h:commandLink value="#{result.entityName}"
actionListener="#{form.collapseRow}"
rendered="#{result.renderExactToggle}"
title="ID=#{result.identity}"/>
</f:facet>
<hutputText value="#{expand.key}"/>
</h:column>
<h:column>
<hutputText value="#{expand.value}"/>
</h:column>
</h:dataTable>
</h:column>
<h:column>
<f:facet name="header">
<hutputText value="Street"/>
</f:facet>
<hutputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>
</h:column>
<h:column>
<f:facet name="header">
<hutputText value="Street"/>
</f:facet>
<hutputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>

</h:column>
<h:column>
<f:facet name="header">
<hutputText value="Street"/>
</f:facet>
<hutputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>
</h:column>

</h:dataTable>
...

(the last 3 columns arent the real data itself, but that's not important
for the purpose of this question...)

I'm using JSF 1.1.

Basically, this code works fine, but again, I'd like to have that inner row exposed and stretch across the entire table instead of being treated like a single non-spanning column as it's originally layed out. (The actionListener for the command links toggle a pair of booleans that toggle between full and general views.)

Is there any way to do this ? .. I've already tried to add a separate column and declare it to be a 100% width, mess with the stylesheet reference(s) declared in the headerClass attribute of the outer table, but to no avail. (Also tried to mess with the 'rendered' attribute on the <h:column> tags themselves, but this doesnt work. )

Appreciate any insights.

Thank you,
Chad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic