0 Replies Latest reply on Dec 13, 2010 10:21 AM by Blanca Hernandez

    Drop event problem

    Blanca Hernandez Newbie

      Hello, this piece of code is giving me problems (richafaces 3.3.2.GA):

       

      <rich:dragIndicator id="indicator"> </rich:dragIndicator>
      
                           <h:dataTable id="myData" value="#{resultArray}" var="data" >
                               <h:column>
                                   <a4j:outputPanel>
                                  
                                      <rich:dragSupport id="myDrag" dragIndicator="indicator" dragType="sug" dragValue="#{data}" >
                                          <rich:dndParam name="name" value="#{data.name}" >
                                              </rich:dndParam>                               
                                      </rich:dragSupport>
                                      <h:outputText value="#{data.name}"></h:outputText>
      
      
                                  </a4j:outputPanel>
                               </h:column>
                           </h:dataTable>
                                 
              <rich:panel id="myPanel">
                  <f:facet name="header">Drop Zone</f:facet>
                      <rich:dropSupport id="dropZone" acceptedTypes="sug" dropListener="#{dropSuggestion}" reRender="box"/>
                  </rich:panel>              
      
              <rich:dataTable  id="box" value="#{nameList}" var="cap2">
                  <f:facet name="caption">Concepts chosen</f:facet>
                      <h:column>
                          <h:outputText value="#{cap2.name}"/>
                      </h:column>
              </rich:dataTable>
      

       

      The action called:

       

      public void dropSuggestion(DropEvent event) 
      
                   System.out.println("OntologyActions.dropSuggestions");
                  FacesContext context = FacesContext.getCurrentInstance();
      
                  OntologyActions dropItem = new OntologyActions();
                  String dropItemString=event.getDragValue().toString();
                  
                 //Get request items
                  dropItem= (OntologyActions) event.getDragValue();
                  
                 //Locate the position of the dropped element
                 int index = dropItem.resultArray.indexOf(dropItemString);
                 
                 System.out.println("String: " + dropItemString + " DropItem: " + dropItem.resultArray.get(index).name + " Index: " + index);
                 
                 //Add the element to the selected array
                     selectedSuggestionsArray.add(dropItem.resultArray.get(index));
                  nameList.add(dropItemString);
                  
                 //resultArray.remove(dropItem);
           }
      

       

       

      The problem is, when I drop the element into the drop  zone, no actions happen, but I am sure it can see this drop zone,  because I see green or red colors, depending on the acceptedTypes.

      But the concept is not removed from the container, and is not either added on the drop zone.

       

      When I am reaching this page, I get this error:

      drop: Element with [form1:j_id640:_form:myPanel] ID was not found in the DOM tree. 
      Probably element has no client ID or client ID hasn't been written. DnD's disabled. Check please!
      

       

      And in JSF console (but just in the first attempt):

      Node was not found"  code: "8

       

      Is this familiar to anybody??

       

      Thanks in advance