2 Replies Latest reply on Nov 23, 2010 6:42 AM by renegritsch

    treeNode selection problem with dragSupport

    renegritsch

      Hi,

       

      as soon as I add the the dragsupport, which works fine btw, my tree node won´t get selected anymore.

      Do i something wrong with the events or is this because the onclick event gets overriden by the dragsupport?

       

      Here our example:

       

       

      {code:xml}

      <rich:tree

                id="tree"

                switchType="ajax"

                nodeSelectListener="#{tree.nodeSelect}"

                ajaxSubmitSelection="true"

                ajaxSingle="true"

                adviseNodeSelected="#{treeStateAdvisor.adviseNodeSelected}"

                adviseNodeOpened="#{treeStateAdvisor.adviseNodeOpened}"

                style="height:#{browser.innerHeight}px">

                      <rich:recursiveTreeNodesAdaptor roots="#{tree.workspace}" var="item" nodes="#{item.children}">

                          <rich:treeNode selectedClass="rich-tree-node-selected" ajaxSingle="true" ajaxSubmitSelection="true" onmousedown="return false;" icon="#{resources.image(item.icon)}" iconLeaf="#{resources.image(item.icon)}">

                               <a4j:support rendered="#{item.enabled and item.hasSingleClick()}" event="onclick" action="#{boController.startConsultation(item.getSingleClickAction())}" immediate="true" ajaxSingle="true" bypassUpdates="true" ignoreDupResponses="true">

                                 <s:conversationPropagation type="none"/>

                               </a4j:support>

                               <h:outputText id="listEntryID" value="#{item.name}"/>

       

                               <rich:dragSupport rendered="#{item.allowDragAndDrop()}" dragIndicator=":indicator" dragType="#{item.dragAndDropType}" dragValue="#{item}" acceptedTypes="#{item.dragAndDropType}">

                                 <rich:dndParam name="label" value="#{item.name}" />    

                               </rich:dragSupport>

                          </rich:treeNode>

                      </rich:recursiveTreeNodesAdaptor>

                  </rich:tree>

      {code}

        • 1. Re: treeNode selection problem with dragSupport
          ilya_shaikovsky

          I tried built-in(at treeNode level) and external(with dragSupport) drag definitions and them works fine on my side using 3.3.3.Final. you could check built-in which works fine with selection there http://livedemo.exadel.com/richfaces-demo/richfaces/tree.jsf?tab=dnd&cid=473667

           

          B.t.w. why you do not using treeNode definitions? In that case you could avoid conditional rendering and allow dnd only for specific kind of nodes as it done at demo.

          • 2. Re: treeNode selection problem with dragSupport
            renegritsch

            I didn´t send you the full xhtml code. I´m include a common part inside the treenode

            and reuse it also in our menu,... that´s why i thought it would be better to do it that way.

             

            <rich:tree         dragIndicator=":indicator"

                                   dragValue="#{item}"

                                   dragType="#{item.dragAndDropType}"

                                   ...

                                   >

             

            I´ve added now the drag support directly to the tree, now everything works fine with the selection and dnd.

             

            Thnx for your help, René!