I am new to primefaces. I am migrating from primefaces2.2 to primefaces3.1.1 because i have to include the new features of primefaces3.1.1 in application.
There was a dragndrop functionality in application. It is working fine with primefaces2.2, but when i made changes according to the specifications of primefaces3.1.1. The dragndrop functionality is not working.
Actually the scenario is like
I have a datatable where i am getting values from database and displaying. There is a treetable.
The datatable row is to be dragged and dropped on the treetable area. While doing so i have written the listener but it is never called.
Here i am providing the code
workflow.xhtml
<p:fieldset id="workflowtabs" legend="Drop here" rendered="#{workflowStep2Bean.childCount gt 0}">
<p:outputPanel id="dropArea">
<p:treeTable id="testtable" value="#{workflowStep2Bean.root}" var="selected" rendered="#{not empty workflowStep2Bean.root}" >
<p:column rendered="#{selected.type eq 'Folder'}">
<p:commandButton icon="ui-icon ui-icon-folder-open" disabled="true"/>
</p:column>
<p:column rendered="#{selected.type eq 'Folder'}" >
<h:inputText value="#{selected.name}" />
</p:column>
</p:treeTable>
</p:outputPanel>
</p:fieldset>
<p:fieldset id="testfields" legend="#{msg.tests}" rendered="#{workflowStep2Bean.childCount gt 0}">
<p:dataTable id="teststable" value="#{workflowStep2Bean.tests}" var="testList" >
<p:column style="height: 20px" headerText="Drag">
<h:outputText id="dragIcon" styleClass="ui-icon ui-icon-arrow-4"/>
<p:draggable for="dragIcon" revert="true" scope="#{dragIcon.position}" stack=".ui-icon ui-icon-arrow-4"/>
</p:column>
<p:column headerText="Name">
<h:outputText value="#{testList.name}"></h:outputText>
</p:column>
</p:dataTable>
</p:fieldset>
<p:droppable for="workflowtabs" tolerance="touch" activeStyleClass="ui-state-highlight" datasource="teststable" onDrop="handleDrop">
<p:ajax listener="#{workflowStep2Bean.onTestDrop}" update="dropArea teststable" />
</p:droppable>
and here is my workflowStep2Bean.java
public void onTestDrop(DragDropEvent ddEvent) {
if (getTabs().size() > 0) {
TreeNode tab = getTabs().get(getTabs().size() - 1);
Test t = (Test) ddEvent.getData();
tests.remove(t);
((Tab) tab.getData()).getTests().add(t);
TreeNode tabC = new DefaultTreeNode(t, tab);
}
}
Please tell me where i am doing wrong. Thank in advance
I am using primefaces 3.1.1, Mojorra 2.1.3, Glassfish 3.1.1, JSF2.0