You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Anu Padki <an...@gmail.com> on 2005/10/22 09:01:02 UTC

tree2 HtmlTree and saveSate Question

I am trying to get the lazy loading working for tree2.
A lot of debugguibg shows that the changed value of the nodes is not
persistent acorss the requests.
After I quit from the ActionListener, the new nodes are forgotten.
I suspect I have to call saveState on the tree. Any one knows how to use
saveState.
Any clues? Is this the right direction to go?
- Anu

Re: tree2 HtmlTree and saveSate Question

Posted by Marcel Ruff <mr...@marcelruff.info>.
Anu Padki wrote:

> Can you please explain briefly what does the second commandlink under 
> the panelGrid mean? What is projectTable.jsp and  what is toViewId's 
> function?
> Thanks.
> - Anu
>
><t:tree2 id="serverTree" value="#{navigationBacker.treeData}"
>  
>
>        <h:commandLink action="#{navigationBacker.toViewId}"
>
>            styleClass="#{t.nodeSelected ? 'documentSelected':'document'}"
>            actionListener="#{navigationBacker.nodeClicked}"
>            value="#{node.description}" immediate="true">
>
>            <f:param name="db_id" value="#{node.identifier}" />
>            <f:param name="toViewId" value="projekteTable.jsp" />
>  
>
Sorry, yes,  this shouldn't be there for this example.

This is my navigation control, just ignore it in this context.

regards,
Marcel

Re: tree2 HtmlTree and saveSate Question

Posted by Anu Padki <an...@gmail.com>.
Can you please explain briefly what does the second commandlink under the
panelGrid mean? What is projectTable.jsp and what is toViewId's function?
Thanks.
- Anu

<t:tree2 id="serverTree" value="#{navigationBacker.treeData}"
    var="node" varNodeToggler="t" clientSideToggle="false" showNav="false"
    showRootNode="false">
    <f:facet name="projekt-folder">
      <h:panelGroup>
        <h:commandLink action="#{t.toggleExpanded}"
actionListener="#{navigationBacker.processAction}">
            <t:graphicImage value="/images/yellow-folder-open.png"
                rendered="#{t.nodeExpanded}" border="0" />
            <t:graphicImage value="/images/yellow-folder-closed.png"
                rendered="#{!t.nodeExpanded}" border="0" />
        </h:commandLink>
        <h:commandLink action="#{navigationBacker.toViewId}"
            styleClass="#{t.nodeSelected ? 'documentSelected':'document'}"
            actionListener="#{navigationBacker.nodeClicked}"
            value="#{node.description}" immediate="true">
            <f:param name="db_id" value="#{node.identifier}" />
            <f:param name="toViewId" value="projekteTable.jsp" />
        </h:commandLink>
        <h:outputText value=" (#{node.childCount})" styleClass="childCount"
            rendered="#{!empty node.children}" />
      </h:panelGroup>
    </f:facet>



On 10/22/05, Marcel Ruff <mr...@marcelruff.info> wrote:
>
> Anu Padki wrote:
>
> > I am trying to get the lazy loading working for tree2.
> > A lot of debugguibg shows that the changed value of the nodes is not
> > persistent acorss the requests.
> > After I quit from the ActionListener, the new nodes are forgotten.
> > I suspect I have to call saveState on the tree. Any one knows how to
> > use saveState.
> > Any clues? Is this the right direction to go?
> > - Anu
>
> Hi Anu,
>
> the <x:saveState> has nothing to do with your problem.
>
> The code snippets i have written in
> http://wiki.apache.org/myfaces/Tree2
> works perfectly for me to lazy load the tree nodes.
> Note that my backer beans are in the "session" scope,
> configured in WEB-INF/examples-config.xml.
>
>
> You may, at a later development stage, miss the browser-back-button
> functionality.
> You press 'BACK' and the navigation
> of the previous page (from browser cache) does not work,
> than <x:saveState> comes into the game.
> Put your backer beans now in the "request" scope
> and declare them with
> <x:saveState id="navigationBacker_Save" value="#{navigationBacker}" />
> <x:saveState id="stindexScrollerList_Save"
> value="#{stindexScrollerList}" />
> ...
> in your jsp page, and all is well :-).
> See http://wiki.apache.org/myfaces/How_JSF_State_Management_Works
>
> regards
> Marcel
>
> PS: I have updated http://wiki.apache.org/myfaces/Tree2 as well
>

Re: tree2 HtmlTree and saveSate Question

Posted by Marcel Ruff <mr...@marcelruff.info>.
Anu Padki wrote:

> I am trying to get the lazy loading working for tree2.
> A lot of debugguibg shows that the changed value of the nodes is not 
> persistent acorss the requests.
> After I quit from the ActionListener, the new nodes are forgotten.
> I suspect I have to call saveState on the tree. Any one knows how to 
> use saveState.
> Any clues? Is this the right direction to go?
> - Anu

Hi Anu,

the <x:saveState> has nothing to do with your problem.

The code snippets i have written in
  http://wiki.apache.org/myfaces/Tree2
works perfectly for me to lazy load the tree nodes.
Note that my backer beans are in the "session" scope,
configured in WEB-INF/examples-config.xml.


You may, at a later development stage, miss the browser-back-button
functionality.
You press 'BACK' and the navigation
of the previous page (from browser cache) does not work,
than <x:saveState> comes into the game.
Put your backer beans now in the "request" scope
and declare them with
   <x:saveState id="navigationBacker_Save" value="#{navigationBacker}" />
   <x:saveState id="stindexScrollerList_Save" 
value="#{stindexScrollerList}" />
   ...
in your jsp page, and all is well :-).
See http://wiki.apache.org/myfaces/How_JSF_State_Management_Works

regards
Marcel

PS: I have updated http://wiki.apache.org/myfaces/Tree2 as well