Moin,
what you can do is to set a binding to a HtmlDataTable in your bean.
private HtmlDataTable dataTable;
Then you can do dataTable.expandAllDetails() or dataTable.collapseAllDetails()
The binding in the dataTable lokks like:
binding="#{BEAN.dataTable}"
I do this, because i want to expand and collapse the table outside from the
dataTable in the jsp.
Greetings MIchael
Am Freitag 02 Februar 2007 08:52 schrieb HENRY Pierre:
> Up ?
> Anybody ?
>
> -----Message d'origine-----
> De : HENRY Pierre [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi, 31. janvier 2007 09:24
> À : [email protected]
> Objet : MasterDetail datatable, toggle all rows expanded, save state,
> detailStamp
>
> Hello,
>
> I am pretty new to JSF and MyFaces. I managed to use the master-detail
> feature of the extended data table, and it works fine, except for 2 things
> :
>
> First, Is it possible to set the initial state of the table to all rows
> expanded (currentDetailExpanded=true) ?
>
> I found related threads e.g. here
> http://www.mail-archive.com/[email protected]/msg31418.html and here
> http://www.mail-archive.com/[email protected]/msg31509.html but no
> real answer. Anybody can help with that ?
>
>
> Secondly, is it possible to store the state of the table so that when I go
> to another page (e.g. edition of one of the entities managed in the table
> or a new one) and then go back to the table, the rows that were expanded
> still are expanded ? (something similar to the technique used for storing
> the state of the scrolling here maybe :
> http://wiki.apache.org/myfaces/ManagingDataScrollerPage?highlight=%28dat
> ascroller%29)
>
> I am working with MyFaces 1.1.4 and Tomahawk 1.1.5 snapshot.
>
> And finally here is my code for the table :
>
> <t:dataTable
> headerClass="standardTable_Header"
> footerClass="standardTable_Header"
> rowClasses="standardTable_Row2"
> styleClass="standardTable"
> id="domainsDataTable"
> width="800px"
> align="left"
> border="0"
> cellspacing="2"
> cellpadding="2"
> var="domain"
> rows="10"
> preserveDataModel="true"
> rendered="true"
> value="#{domainsList.domains}"
> varDetailToggler="domainsDetailToggler"
>
>
>
> <t:column width="20px">
> <h:commandButton
>
> rendered="#{domainsDetailToggler.currentDetailExpanded}"
>
> action="#{domainsDetailToggler.toggleDetail}"
>
> image="images/tree-collapse.gif">
> </h:commandButton>
> <h:commandButton
>
> rendered="#{!domainsDetailToggler.currentDetailExpanded}"
>
> action="#{domainsDetailToggler.toggleDetail}"
> image="images/tree-expand.gif">
> </h:commandButton>
> </t:column>
>
> <t:column width="700px">
> <f:facet name="header">
>
> <h:outputText
>
> value="#{bundle.domain_name}"
>
> style="width:30%" />
>
> </f:facet>
> <h:commandLink
> immediate="true"
> action="go_domainForm"
> rendered="true"
> value="#{domain.name}">
> <t:updateActionListener
>
> property="#{domainForm.domainId}"
>
> value="#{domain.domainId}" />
> </h:commandLink>
> </t:column>
>
> <t:column width="120px">
> <f:facet name="header">
> <h:outputText
> value="#{bundle.lists_action}" />
> </f:facet>
>
> <h:panelGrid columns="5">
>
> <h:commandButton
> immediate="true"
>
> action="#{domainForm.moveUp}"
> rendered="true"
>
> value="#{bundle.lists_action_edit}"
>
> title="#{bundle.lists_action_edit}"
>
> image="images/icons/arrow-up.gif">
>
> <t:updateActionListener
>
> property="#{domainForm.domainId}"
>
> value="#{domain.domainId}" />
> </h:commandButton>
>
> Some other buttons here...
>
> </h:panelGrid>
> </t:column>
>
> <f:facet name="detailStamp">
>
> Here comes a t:dataTable really similar to the main Data table.
>
> </f:facet>
>
> <f:facet name="footer">
>
> </f:facet>
>
> </t:dataTable>
>
>
>
>
> Thanks in advance for any hint,
>
> Pierre Henry