2 Replies Latest reply on Dec 6, 2007 2:52 AM by ratondeau

    Drag-Drop problem

    ratondeau

      Hello,

      Modified the drag-n-drop example from the demo a bit and the following question occured:

      How do I find out the drag source (dataTable or panel is or any string) if I drag a panel around?

      I tried to use the actionParameter tag but it is called after the drop event so it will not work this way.
      Every panel should support both drag and drop. I want to put back an element from php stack back
      to the first panel and it should be possible to drop each item into any of the panels. So I need to know
      where the item comes from to remove it from the list.

      <rich:panel styleClass="dropTargetPanel">
       <f:facet name="header">
       <h:outputText value="PHP Frameworks" />
       </f:facet>
      
       <rich:dropSupport id="php" acceptedTypes="PHP,CF,DNET" dropValue="PHP"
       dropListener="#{eventBean.processDrop}" reRender="phptable, src">
       </rich:dropSupport>
      
       <h:dataTable id="phptable" columns="1" value="#{dndBean.containerPHP}" var="fm">
       <h:column>
       <a4j:outputPanel style="border:1px solid gray;padding:2px;" layout="block">
       <rich:dragSupport dragType="#{fm.family}" dragValue="#{fm}">
       <rich:dndParam name="label" value="#{fm.name}" />
       <a4j:actionparam name="source" value="PHP-STACK" assignTo="#{dndBean.source}"/>
       </rich:dragSupport>
       <h:outputText value="#{fm.name}"></h:outputText>
       </a4j:outputPanel>
       </h:column>
       </h:dataTable>
      </rich:panel>

      I suppose the solution is quite easy but I do not know how. The setter of the source property
      is called after the processDrop method is called.

      Thanks for every help

      Regards
      Matt

        • 1. Re: Drag-Drop problem
          pankaj.ghosh

          Hopefully I have understood your problem correctly.

          When you are processing a drop event, you can fetch 3 values: dragValue, dropValue and dragType. You can set the dragType to sourcePanelName to know the source of drag.

          Hope this helps.

          Pankaj

          • 2. Re: Drag-Drop problem
            ratondeau

            yes you have understood it properly. I solved it with the help of your advise.

            Thanks

            Matt