• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

nested h:datatable question

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText 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>
<h:outputText value="#{expand.key}"/>
</h:column>
<h:column>
<h:outputText value="#{expand.value}"/>
</h:column>
</h:dataTable>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>

</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText 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
 
Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic