bonjour a tous
j'ai un problème avec la fonction sortBy, quand je clic pour trié ne marche pas et mon dataTable marche bien et affiche tout !!
voila console :
voila vue xhtmlInfo: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
et voila class bean :
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 <body> <ui:composition template="./../template.xhtml"> <ui:define name="content"> <p:growl id="msgs" showDetail="true" /> <h:form> <p:commandButton id="btnCategorieCreate" update=":formCreate" oncomplete="PF('dialogCategorieCreate').show()" icon="ui-icon-plus" title="create" value="Créer"/> </h:form> <h:form id="formDataTable"> <p:commandButton value="Export as PDF" ajax="false" > <p:dataExporter type="pdf" target="basicDT" fileName="demande"/> </p:commandButton> <p:dataTable id="basicDT" var="categorie" value="#{categorieBean.categories}" paginator="true" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" paginatorPosition="bottom"> <f:facet name="header"> Liste des catégories </f:facet> <p:column headerText="Description" sortBy="#{categorie.descriptionCategorie}"> <h:outputText value="#{categorie.descriptionCategorie}" /> </p:column> <p:column headerText="Quantité"> <h:outputText value="#{categorie.quantite}" /> </p:column> <p:column style="width:5%;"> <p:commandButton id="btnUpdate" update=":formUpdate" oncomplete="PF('dialogCategorieUpdate').show()" icon="ui-icon-search" title="Modifier"> <f:setPropertyActionListener value="#{categorie}" target="#{categorieBean.selectedCategorie}" /> </p:commandButton> <p:commandButton id="btnDelete" update=":formDelete" oncomplete="PF('dialogCategorieDelete').show()" icon="ui-icon-trash" title="supprimer"> <f:setPropertyActionListener value="#{categorie}" target="#{categorieBean.selectedCategorie}" /> </p:commandButton> </p:column> </p:dataTable> </h:form>
et voila affichage :
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 import javax.inject.Named; import javax.enterprise.context.RequestScoped; @Named(value = "categorieBean") @RequestScoped public class CategorieBean { @PostConstruct public void init() { selectedCategorie = new Categorie(); newCategorie = new Categorie(); } public List<Categorie> getCategories() { CategorieDao categorieDao = new CategorieDaoImpl(); this.categories = categorieDao.findAll(); return categories; } }
Je sais pas ou ce trouve le problème, filterBy aussi ne fonctionne pas
merci d'avance
Partager