Bonjour,
Voila j'ai un problème avec le drag and drop. Malgré la documentation consulté j'arrive pas à en venir à bout.
J'utilise richfaces 4 et voici mon bout de code qui s'inspire des exemples richfaces 4:
Sans le dragIndicator (le composant dragSource sans la propriété dragIndicator), j'ai le drag qui s'effectue (le vois le déplacement de mon objet) mais lors du drop rien ne se passe. Et bien avant le drop les alertes (grâce au css) me permettant de savoir si l'objet est accepté ou pas ne fonctionnent pas. Quand j'intègre le dragIndicator, le drag ne s'effectue plus. Je comprends plus rien puisque je crois avoir suivi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 <?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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head> <title>IGNORED</title> </h:head> <body> <ui:composition> <h:outputStylesheet> .default{ font-size:11px; cursor:pointer; width:100px; border:1px solid gray; padding:2px } .rf-ind-drag.default{ padding-left:30px; background-position: 5px; background-repeat: no-repeat; } .rf-ind-drag.accept{ background-position: 5px; background-repeat: no-repeat; border:2px solid green } .rf-ind-drag.reject{ border:2px solid red; background-position: 5px; background-repeat: no-repeat; } </h:outputStylesheet> <a4j:outputPanel id="pan4" layout="block"> <h:form id="navigationTab"> <rich:panel > <h:dataTable id="src" columns="1" value="#{mysession.list2art}" var="fm" > <h:column> <a4j:outputPanel layout="block" styleClass="default"> <rich:dragIndicator id="ind" acceptClass="accept" rejectClass="reject" draggingClass="default"> Drag the item to proper area.. </rich:dragIndicator> <rich:dragSource type="articlelangue" dragValue="#{fm}" /> <h:outputText value="#{fm.article.titre}"></h:outputText> </a4j:outputPanel> </h:column> </h:dataTable> </rich:panel> <rich:panel > <f:facet name="header"> <h:outputText value="PHP Frameworks" /> </f:facet> <rich:dropTarget acceptedTypes="articlelangue" dropValue="PHP" dropListener="#{mysession.processDrop}" /> <h:dataTable id="src2" columns="1" value="#{mysession.list2art}" var="fm" > <h:column> <h:outputText value="#{fm.article.titre}"></h:outputText> </h:column> </h:dataTable> </rich:panel> </h:form> </a4j:outputPanel> </ui:composition> </body> </html>
les exemples. Any suggestion? Merci d'avance!![]()
Partager