Draggable and Droppable should have value attributes to easily identify what has been dragged and dropped onto.
be wonderful to see some API methods like this:
public void onDragDrop(DragDropEvent event) {
List<Car> selectedCarsToMove = (List<Car>) event.getDragObject();
TreeNode dropNodeCategory = (TreeNode) event.getDropObject();
}
for others people old link of discussions:
https://code.google.com/p/primefaces/issues/detail?id=1469
http://forum.primefaces.org/viewtopic.php?f=3&t=5952
on this moment I found only one workaround, but in my opinion this is bad way
<p:treeNode>
<h:outputText id="selectedCategoryNode" value="#{node}" />
<p:droppable for="selectedCategoryNode" scope="tabletotree"
datasource="nomenclatureTable" activeStyleClass="ui-state-highlight" tolerance="touch">
<p:ajax listener="#{catalogBean.onDragDropTree}" update="nomenclatureTable msgs"/>
<f:attribute name="category" value="#{node}" />
</p:droppable>
</p:treeNode>
<!-- <p:dataTable id="nomenclatureTable" -->
<p:column id="drag" style="width:20px">
<h:outputText id="dragIcon" styleClass="ui-icon ui-icon-arrow-4" />
<p:draggable for="dragIcon" scope="tabletotree" revert="true" helper="clone" />
</p:column>
public void onDragDropTree(DragDropEvent event) {
FacesMessage message;
try {
Nomenclature nomenclature = (Nomenclature) event.getData();
Nomenclature category;
if (event.getComponent().getAttributes().get("category") instanceof String) {
category = new Nomenclature(0L, "ΠΠΎΠΌΠ΅Π½ΠΊΠ»Π°ΡΡΡΠ°");
} else {
category = (Nomenclature) event.getComponent().getAttributes()
.get("category");
}
nomenclatureService.move(category, nomenclature);
nomenclatureList = nomenclatureService.getNomenclature(parentId);
message = new FacesMessage(FacesMessage.SEVERITY_INFO,
"ΠΠ΅ΡΠ΅ΠΌΡΡΠ΅Π½Π½Ρ", "ΠΠΎΠΌΠ΅Π½ΠΊΠ»Π°ΡΡΡΠ° " + nomenclature
+ " ΠΏΠ΅ΡΠ΅ΠΌΡΡΠ΅Π½Π° Π² ΠΊΠ°ΡΠ΅Π³ΠΎΡΡΡ " + category);
} catch (Exception e) {
message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "ΠΠΎΠΌΠΈΠ»ΠΊΠ°",
"ΠΠΈΠ½ΠΈΠΊΠ»Π° ΠΏΠΎΠΌΠΈΠ»ΠΊΠ° ΠΏΡΠΈ ΠΏΠ΅ΡΠ΅ΠΌΡΡΠ΅Π½Π½Ρ");
}
FacesContext.getCurrentInstance().addMessage(null, message);
}
Will this feature be added/implemented anytime soon?
No plans but you can sponsor it via PrimeFaces Pro or provide a PR ;)
This issue is marked as stale because there was no activity on it for the last 2 years. Remove stale label or comment or this will be closed in 30 days
Most helpful comment
on this moment I found only one workaround, but in my opinion this is bad way