bonjour j'ai un problème sur <p:selectCheckboxMenu il ne peux récupérer des valeurs des phones d-un clients (relation One to Meny unidiractionelle)
mais le problème c'est d’afficher les phone dans <p:selectCheckboxMenu pas cocher par defaut consecrnat les phones déjà associer a un client ...
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133 <?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:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:head> <title>Sale Item</title> </h:head> <h:body> <script type="text/javascript"> function addRowOnComplete() { jQuery('.ui-datatable-data tr td').last().find('span.ui-icon-pencil').each(function(){jQuery(this).click();}); } </script> <h:form id="form1" style="width:100%"> <p:growl id="messages" showDetail="true"/> <p:panel header="Sale Item" style="width:100%"> <p:panelGrid columns="2"> <f:facet name="footer"> <p:commandButton value="ajouter client " action="#{CustomerBeansController2.ajouterclient()}" /> <p:commandButton value="ajouter object" action="#{cruiseResevation.addCruisereservation}"/> <p:commandButton value="ajouter phones" action="#{phoneBeansController.addPhone()}"/> <p:commandButton value="ajouter Customer" action="#{customerBeansController.addClient()}"/> <p:commandButton value="add row" actionListener="#{customerBeansController2.newLine}" update="table" oncomplete="addRowOnComplete()"/> <p:commandButton value="dir bonjour " action="#{customerBeansController2.bonjour()}" /> </f:facet> </p:panelGrid> <p:spacer height="30px;"/> <p:dataTable value="#{customerBeansController2.customers}" id="table" var="o" widgetVar="50" style="width: 100%;" editable="true" scrollHeight="330" styleClass="datatable"> <p:ajax event="rowEdit" listener="#{customerBeansController2.onEdit}" update=":form1:table" process="@this" /> <f:facet name="header"> Order List </f:facet> <p:ajax event="rowEditCancel" listener="#{customerBeansController2.onCancel}" update=":form1:messages" /> <!--exemple--> <p:column> <f:facet name="header" > <h:outputText value="ID customer" style="width:100%"/> </f:facet> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{o.id}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{o.id}" style="width:100%"/> </f:facet> </p:cellEditor> </p:column> <!--exemple--> <!--exemple--> <p:column> <f:facet name="header"> <h:outputText value="firstName" /> </f:facet> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{o.firstName}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{o.firstName}" style="width:100%"/> </f:facet> </p:cellEditor> </p:column> <p:column> <f:facet name="header"> <h:outputText value="lastName" /> </f:facet> <p:cellEditor> <f:facet name="output"> <h:outputText value="#{o.lastName}" /> </f:facet> <f:facet name="input"> <p:inputText value="#{o.lastName}" style="width:100%"/> </f:facet> </p:cellEditor> </p:column> <p:column> <f:facet name="header"> <h:outputText value="SelectManyMenu" style="width:100%" /> </f:facet> <p:cellEditor> <f:facet name="input"> <p:selectCheckboxMenu label="phones" value="#{o.phoneNumbers}" converter="userConverter" filter="true" filterMatchMode="contains" > <f:selectItems itemLabel="Label1" itemValue="Label1" /> <f:selectItems value="#{customerBeansController2.phones}" var="phooones" itemLabel="#{phooones.number}" itemValue="#{phooones}" /> </p:selectCheckboxMenu> </f:facet> <f:facet name="output"> <p:selectCheckboxMenu value="#{customerBeansController2.phones}" label="Phones" filter="true" filterMatchMode="startsWith" panelStyle="width:250px" converter="userConverter"> <f:selectItems value="#{o.phoneNumbers}" /> </p:selectCheckboxMenu> </f:facet> </p:cellEditor> </p:column> <p:column headerText="Options" > <p:rowEditor /> </p:column> </p:dataTable> </p:panel> <p:dialog header="Selected Values" modal="true" showEffect="fade" widgetVar="dlg" resizable="false"> </p:dialog> </h:form> </h:body> </html>
Partager