• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to expand and collapse rows in datatable

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello every one,

i've table which displays students and their courses

course is sub table in students where only 5 records are visible when user clicks expand link remaining courses should be displayed for that student.

i've done that but when expand link is clicked all the students courses are
expanding.here is my code

<t:dataTable id="idsTable" rowIndexVar="row"
value="#{Bean.ids}" var="prj" border="1"
cellpadding="1" cellspacing="1" first="0" rows="5">
<f:facet name="header">
<h:outputText value="View Details" />
</f:facet>
<t:column>
<f:facet name="header">
<t:outputText value="#{msg['msg.description']}" />
</f:facet>
<t:outputText value="#{prjs.description}" />
</t:column>
<t:column>
<f:facet name="header">
<t:outputText value="#{msg['msg.location']}" />
</f:facet>
<t:outputText value="#{prj.location}" />
</t:column>
<t:column>
<tr>
<td colspan="12"><h:panelGrid
binding="#{Bean.gridPanel1}" rendered="true">
<t:dataTable id="Table" value="#{prj.ids}" var="bids"
border="2" cellpadding="2" cellspacing="2" first="0" rows="5">
<t:column>
<t:outputText value="Title" />
</t:column>
<t:column>
<t:outputText value="Notes" />
</t:column>
</t:dataTable>
<h:commandLink action="#{Bean.expandProjects}"
value="Expand Link" />

</h:panelGrid> <h:panelGrid binding="#{Bean.gridPanel2}"
rendered="false">
<t:dataTable id="Table1" value="#{prj.bids}" var="bids"
border="1" cellpadding="1" cellspacing="1" first="0">
<t:column>
<t:outputText value="Title" />
</t:column>
<t:column>
<t:outputText value="Notes" />
</t:column>
</t:dataTable>
<h:commandLink action="#{Bean.collapseProjects}"
value="Collapse Link" >
</h:commandLink>
</h:panelGrid></td>
</tr>
</t:column>
</t:dataTable>

<t:dataScroller id="scroller" for="Table" paginator="true"
fastStep="2" paginatorMaxPages="5"
paginatorActiveColumnStyle="fontsize:10px;font-weight:bold;"
immediate="true">
<f:facet name="first">
<t:outputLabel value="first" />
</f:facet>
<f:facet name="last">
<t:outputLabel value="last" />
</f:facet>
<f:facet name="previous">
<t:outputLabel value="previous" />
</f:facet>
<f:facet name="next">
<t:outputLabel value="next" />
</f:facet>
</t:dataScroller>

in this code ive used 2 grid panel one to displaying 5 rows and other displays compelete rows when expand is clicked

please could any one suggest me.
reply
    Bookmark Topic Watch Topic
  • New Topic