Are there any known issues with DND working in WebFlow? I'm using Primefaces 2.2 SWF2.2.
I have a very simple scenario of DND, and the problem is that it works only the first time. Then the page needs to be refreshed to get DND to work again.
Here's the code.
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<body>
<ui:composition template="../templates/internal/BasicTemplate.xhtml">
<ui:define name="content">
<h:form prependId="false">
<p:dataTable id="availableTags" var="tag" value="#{tagsAllBean.tags}">
<p:column style="width:24px">
<h:outputText id="dragIcon"
styleClass="ui-icon ui-icon-arrow-4" />
<p:draggable for="dragIcon" revert="true" helper="clone"/>
</p:column>
<p:column headerText="Tags">
<h:outputText value="#{tag.tag}"/>
</p:column>
</p:dataTable>
<p:outputPanel id="test">
<h:outputText value="!!!Drop here!!!" rendered="#{empty tagsAllBean.selectedTags}"
style="font-size:24px;" />
<p:dataTable id="referenceTagList" var="referenceTag" value="#{tagsAllBean.selectedTags}">
<p:column headerText="Tags">
<h:outputText value="#{referenceTag.tag}"/>
</p:column>
</p:dataTable>
</p:outputPanel>
<p:droppable for="referenceTagList" tolerance="touch"
activeStyleClass="ui-state-highlight" datasource="availableTags"
dropListener="#{tagsAllBean.onTagDrop}" onDropUpdate="test" />
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
Code: Select all
/**
*
*/
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.primefaces.event.DragDropEvent;
public class TagsAllBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3498022112306933996L;
/**
*
*/
private List<Tag> tags = new ArrayList<Tag>();
private Tag selectedTag;
private List<Tag> selectedTags = new ArrayList<Tag>();
public List<Tag> getSelectedTags() {
return selectedTags;
}
/*public void setSelectedTags(List<Tag> selectedTags) {
this.selectedTags = selectedTags;
}*/
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public List<Tag> getTags() {
return tags;
}
public void setSelectedTag(Tag selectedTag) {
this.selectedTag = selectedTag;
}
public Tag getSelectedTag() {
return selectedTag;
}
public void onTagDrop(DragDropEvent ddEvent) {
Tag tag = ((Tag) ddEvent.getData());
//System.out.println("adding tag : " + tag.getTag());
selectedTags.add(tag);
}
}
T.