這段代碼是給我的問題(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