IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

Primefaces dateTable sortby ne marche pas !


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2012
    Messages : 16
    Par défaut Primefaces dateTable sortby ne marche pas !
    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 :
    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_
    Info: Hibernate: select categorie0_.idCategorie as idCatego1_1_, categorie0_.descriptionCategorie as descript2_1_, categorie0_.quantite as quantite3_1_ from dbsalama.categorie categorie0_
    voila vue xhtml

    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 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
    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;
        }
    }
    et voila affichage :
    Nom : 27-08-2015 15-58-38.jpg
Affichages : 193
Taille : 112,2 Ko

    Je sais pas ou ce trouve le problème , filterBy aussi ne fonctionne pas

    merci d'avance

  2. #2
    Membre averti
    Homme Profil pro
    Chef de projet en SSII
    Inscrit en
    Juillet 2015
    Messages
    62
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Juillet 2015
    Messages : 62
    Par défaut
    Qu'entend tu par "ne marche pas" ? As-tu une erreur ou c'est juste visuel ?

  3. #3
    Modérateur
    Avatar de Alkhan
    Homme Profil pro
    ingénieur full stack
    Inscrit en
    Octobre 2006
    Messages
    1 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : ingénieur full stack

    Informations forums :
    Inscription : Octobre 2006
    Messages : 1 232
    Par défaut
    bonjour,

    As tu essayé de mettre le sortBy="#{categorie.descriptionCategorie}" sur la datatable plutot que sur la column ?
    Il n'y a pas de problème, il n'y a que des solutions.
    Cependant, comme le disaient les shadoks, s'il n'y a pas de solution, c'est qu'il n'y a pas de problème.
    Si toutefois le problème persiste, la seule solution restante est de changer le périphérique qui se trouve entre la chaise et l'écran

    Mes Articles : Mon premier article est sur le language D
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  4. #4
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Mai 2011
    Messages
    790
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations forums :
    Inscription : Mai 2011
    Messages : 790
    Par défaut
    essaye de mettre tes sortby sur toutes les colonnes et à la fin tu met un sortby sur ton dataTable

Discussions similaires

  1. Réponses: 1
    Dernier message: 16/11/2018, 15h04
  2. Réponses: 0
    Dernier message: 08/04/2015, 13h16
  3. [PrimeFaces] ImageSwitch ne marche pas
    Par sillimi18 dans le forum JSF
    Réponses: 1
    Dernier message: 26/04/2013, 15h34
  4. Réponses: 2
    Dernier message: 21/12/2012, 11h28
  5. primefaces : l'autocomplete ne marche pas
    Par olivier57b dans le forum JSF
    Réponses: 0
    Dernier message: 01/11/2010, 15h43

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo