4 Replies Latest reply on Feb 29, 2008 5:52 AM by stefan r

    Rerendering for Drag&Drop Tree does not work

    Stephan Schneider Newbie

      Hi! I'm using Richfaces RC3 and want my tree to update as soon as I drop a treenode onto another one. Though I use a reRender Attribute, the tree is not updated. But when I refresh the site manually, I can see the changes.

      Already tried the workaround here:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=114533
      ,but with no success....


        • 1. Re: Rerendering for Drag&Drop Tree does not work
          Robin Young Newbie

          I have the same issue.

          More generally I would like to reRender the source branch of the tree, the destination branch and even another part of the page altogether all on a sucessful drop. Of course I dont want anything reRendered in normal use or on an unsucessful drop.

          Does anyone out there have a workaround that doesn't involve reRendering huge portions of the screen?

          • 2. Re: Rerendering for Drag&Drop Tree does not work
            Pankaj Ghosh Newbie

            Try putting the tree inside an <a4j:outputPanel> and reRender the outpur panel after drag and drop event.
            I am implementing the same functionality. Works well for me.

            Thanks
            Pankaj

            • 3. Re: Rerendering for Drag&Drop Tree does not work
              Florian Marwede Expert

              Hmm...Don't know your reason for working with a RC, when a GA is released.

              Is the problem still there? Please post a code snippet. Your question sounds like a "how to set my forms, regions, and so on"-question.

              • 4. Re: Rerendering for Drag&Drop Tree does not work
                stefan r Newbie

                hello, i (=rathernew to richfaces and a4j) am having the quite the same problem.
                after I reRender the outputPanel that contains the tree or the tree itself, i get a javascript error onclick of a node.

                my sourcecode:

                <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
                <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
                <%@ taglib uri="http://richfaces.org/a4j" prefix="a"%>
                <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                <html>
                <head>
                 <base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"%>" />
                 <link rel="stylesheet" type="text/css" href="webresources/CSS/style.css"/>
                 <link rel="stylesheet" type="text/css" href="webresources/CSS/style_hw3.css"/>
                
                </head>
                
                <body>
                Kurse...
                <f:view>
                 <a:status>
                 <f:facet name="start">
                 <h:graphicImage styleClass="hourglass" value="/webresources/images/hourglass.gif"/>
                 </f:facet>
                 </a:status>
                
                <a:outputPanel id="treePanel" ajaxRendered="true">
                
                <rich:dragIndicator id="treeDragIndicator" />
                
                <h:form id="CourseTreeForm">
                
                 <rich:tree
                 id="CourseTree"
                 style="width:300px"
                 switchType="ajax"
                 nodeSelectListener="#{CourseTreeJsfBean.processSelection}"
                 value="#{CourseTreeJsfBean.treeNode}"
                 var="item"
                 nodeFace="#{item.type}"
                 dragIndicator=":treeDragIndicator"
                 dragValue="#{item}"
                 preserveModel="request"
                 componentState="#{CourseTreeJsfBean.treeState}"
                
                 >
                
                 <rich:treeNode type="category" acceptedTypes="course" iconLeaf="webresources/images/courseTree/category.gif" >
                 <h:outputText value="#{item.name}" />
                
                 <rich:componentControl event="oncontextmenu" for="categoryContextMenu" operation="show">
                 <f:param value="#{item.name}" name="name"/>
                 </rich:componentControl>
                 </rich:treeNode>
                
                 <rich:treeNode type="course" dragType="course" iconLeaf="webresources/images/courseTree/course.gif" >
                 <h:outputText value="#{item.name}" />
                 <rich:dndParam name="label" type="drag" value="Kurs: #{item.name}" />
                
                 <rich:componentControl event="oncontextmenu" for="courseContextMenu" operation="show">
                 <f:param value="#{item.name}" name="name"/>
                 </rich:componentControl>
                 <rich:dropSupport acceptedTypes="coursedates,course" dropValue="#{item}" dropListener="#{CourseTreeJsfBean.processDrop}"/>
                 </rich:treeNode>
                
                 <rich:treeNode type="coursedate" dragType="coursedate" nodeClass="coursedate_node" iconLeaf="webresources/images/courseTree/courseDate.gif">
                 <t:dataList var="dateTime" value="#{item.dateTimes}">
                 <h:outputText value="#{dateTime.startDate}" />
                 <h:outputText value="-" />
                 <h:outputText value="#{dateTime.endDate}" />
                 <t:htmlTag value="br"/>
                 </t:dataList>
                
                 <rich:componentControl event="oncontextmenu" for="courseDateContextMenu" operation="show">
                 </rich:componentControl>
                
                 </rich:treeNode>
                 </rich:tree>
                
                <rich:contextMenu attached="false" id="categoryContextMenu" submitMode="ajax">
                 <rich:menuItem ajaxSingle="true">Bearbeiten</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Löschen</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Kurs erstellen</rich:menuItem>
                </rich:contextMenu>
                
                
                <rich:contextMenu attached="false" id="courseContextMenu" submitMode="ajax">
                 <rich:menuItem ajaxSingle="true">Bearbeiten</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Löschen</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Kurstermin erstellen</rich:menuItem>
                </rich:contextMenu>
                
                
                <rich:contextMenu attached="false" id="courseDateContextMenu" submitMode="ajax">
                 <rich:menuItem ajaxSingle="true">Bearbeiten</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Löschen</rich:menuItem>
                 <rich:menuItem ajaxSingle="true">Buchen</rich:menuItem>
                </rich:contextMenu>
                
                </h:form>
                </a:outputPanel>
                
                </f:view>
                </body>
                </html>
                


                what i want is: after dropping a node and processing #{CourseTreeJsfBean.processDrop} i want my tree to completly rerender and keep its state.

                here is the error i get AFTER rerender when i click on a node (not necesserily dragging...). The still ContextMenu works fine after rerendering...

                component has no properties
                fire()events.js.jsf (line 8)
                toggleSelection(mousedown clientX=0, clientY=0)tree-item.js.jsf (line 30)
                clone(mousedown clientX=0, clientY=0)a4j_3_1_3.GAorg.a... (line 18)
                wrapper(mousedown clientX=0, clientY=0)a4j_3_1_3.GAorg.a... (line 243)
                [Break on this error] eventObj[Richfaces.SYNTHETIC_EVENT]=true;return{event:eventObj,fire:function(){i...
                

                error occurs in events.js.jsf

                hope somebody can help me on this, i really need it very urgently.
                thanks a lot.
                BR