3 Replies Latest reply on Jul 13, 2007 2:19 PM by sergeysmirnov

    Drag and Drop Over h:datatable

    thanatos17

      Hi all,

      I'm Newbe with richfaces and I'd like to use the drag and drop solution.
      So I try the Livedemo and I download the code to execute on my own machine.
      It work fine. But when I try to use the same for my application. I have a problem. In the Listener class, when I try to get the getDragValue(), it always NULL.

      This is the code.
      ---------------------

      public void processDrop(DropEvent dropEvent) {
      Dropzone dropzone = (Dropzone) dropEvent.getComponent();
      System.out.println("dropEvent.getDragValue : "+dropEvent.getDragValue()+ " et :"+ dropzone.getDropValue());
      System.out.println("-> "+dropEvent.getDragType());
      System.out.println("--> "+dropzone.getAcceptedTypes());
      dndBean.moveFramework(dropEvent.getDragValue(), dropzone.getDropValue());
      }

      this is my jsf page :
      -------------------------


      <rich:panel>
      <f:facet name="header">
      <h:outputText value="Existing Courses" />
      </f:facet>
      <h:panelGrid columns="1">
      <h:dataTable id="ec" value="#{BeansPageCreationDD.list2}" var="val" columnClasses="col" >
      <f:facet name="header">
      <rich:columnGroup>
      <rich:column>
      <h:outputText value="Courses" />
      </rich:column>
      <rich:column>
      <h:outputText value="Code" />
      </rich:column>
      </rich:columnGroup>
      </f:facet>
      <h:column>
      <rich:spacer width="70"/>
      <h:graphicImage value="/Images/icons/imgmenu.gif" />
      <rich:spacer width="10"/>
      <a4j:outputPanel layout="block">
      <rich:dragSupport dragIndicator=":indicator" dragType="Course" dragValue="#{val}">
      <rich:dndParam name="label" value="#{val.name}" />
      </rich:dragSupport>
      <h:outputText styleClass="textee" value="#{val.name}" />
      </a4j:outputPanel>
      </h:column>
      <h:column>
      <rich:spacer width="20"/>
      <h:graphicImage value="/Images/icons/link.gif"/>
      <rich:spacer width="10"/>
      <h:outputText styleClass="textee" value=" #{val.courseCode} " />
      </h:column>
      </h:dataTable>
      <rich:spacer height="15"/>
      </h:panelGrid>
      </rich:panel>
      </h:form>
      <rich:spacer width="20"/>
      <h:form>
      <rich:panel>
      <f:facet name="header">
      <h:outputText value="Learning Path Creation" />
      </f:facet>

      <rich:dropSupport id="drop" acceptedTypes="Course" dropValue="text"
      dropListener="#{eventBean.processDrop}" reRender="ec, lp" >
      </rich:dropSupport>
      <h:dataTable id="lp" value="#{BeansPageCreationDD.list}" var="val2" columnClasses="col">
      <h:column>
      <h:outputText value="#{val2.name}" />
      </h:column>
      </h:dataTable>
      <rich:spacer height="15"/> </rich:panel>

      Thanks for your answers.