这段代码是给我的问题(RichFaces的3.3.2.GA):拖放RichFaces的问题
<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>
叫动作:
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);
}
的问题是,当我滴元素放入拖放区域,不会发生任何操作,但我确定它可以看到此拖放区域,因为我看到绿色或红色的颜色,具体取决于acceptedTypes。
但是这个概念并没有从容器中删除,也没有添加到拖放区域。
当我到达这个页面,我得到这个错误:
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!
而且在JSF控制台(但只是在第一次尝试),调试与萤火虫:
Node was not found" code: "8
这是熟悉的对任何人?
在此先感谢
该问题与a4j:形式及其不兼容性有关。 – 2011-04-02 10:35:41