开发者

Drag and drop richfaces problem

this piece of code is giving me problems (richfaces 3.3.2.GA):

<rich:dragIndi开发者_如何转开发cator 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), debugging with firebug:

Node was not found" code: "8

Is this familiar to anybody??

Thanks in advance


I think you have defined the dropListener Method incorrectly. It should be dropListener="#{beanName.dropSuggestion}", not only the method name I think. That would explain why no actions are being performed. I'm not sure about the other errors you get.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜