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

Symfony PHP Discussion :

probleme d'implementation du bundle datatable symfony


Sujet :

Symfony PHP

  1. #1
    Membre à l'essai
    Homme Profil pro
    développeur android
    Inscrit en
    Avril 2016
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : Maroc

    Informations professionnelles :
    Activité : développeur android
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Avril 2016
    Messages : 12
    Points : 13
    Points
    13
    Par défaut probleme d'implementation du bundle datatable symfony
    j ai suivi le tuto de swe DataTablesBundle sur le site de github liien
    j'arrive pas a voir le resultat de datatables dans mon twig la page web reste en chargement voila mon code:

    defaultBundle:
    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
    <?php
     
    namespace datatbBundle\Controller;
     
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
    use MyAppFilmothequeBundle\Datatables\ActeurDatatable;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
     
    class DefaultController extends Controller
    {
        /**
         * @Route("/", name="post_index")
         * @Method("GET")
         */
        public function indexAction()
        {
            $datatable = $this->get('app.datatable.post');
            die($datatable);
            $datatable->buildDatatable();
     
            return $this->render('datatbBunble:index.html.twig', array(
                'datatable' => $datatable,
            ));
        }
     
        /**
         * @Route("/results", name="post_results")
         */
        public function indexResultsAction()
        {
            $datatable = $this->get('app.datatable.post');
            $datatable->buildDatatable();
     
            $query = $this->get('sg_datatables.query')->getQueryFrom($datatable);
     
            return $query->getResponse();
        }
    }
    ActeurDataTable qui etai generer avec la commande :php app/console sg:datatable:generate datatbBundle:Acteur --bootstrap3

    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
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    <?php
     
    namespace datatbBundle\Datatables;
     
    use Sg\DatatablesBundle\Datatable\View\AbstractDatatableView;
    use Sg\DatatablesBundle\Datatable\View\Style;
     
    /**
     * Class ActeurDatatable
     *
     * @package datatbBundle\Datatables
     */
    class ActeurDatatable extends AbstractDatatableView
    {
        /**
         * {@inheritdoc}
         */
        public function buildDatatable(array $options = array())
        {
            $this->topActions->set(array(
                'start_html' => '<div class="row"><div class="col-sm-3">',
                'end_html' => '<hr></div></div>',
                'actions' => array(
                    array(
                        'route' => $this->router->generate('acteur_new'),
                        'label' => $this->translator->trans('datatables.actions.new'),
                        'icon' => 'glyphicon glyphicon-plus',
                        'attributes' => array(
                            'rel' => 'tooltip',
                            'title' => $this->translator->trans('datatables.actions.new'),
                            'class' => 'btn btn-primary',
                            'role' => 'button'
                        ),
                    )
                )
            ));
     
            $this->features->set(array(
                'auto_width' => true,
                'defer_render' => false,
                'info' => true,
                'jquery_ui' => false,
                'length_change' => true,
                'ordering' => true,
                'paging' => true,
                'processing' => true,
                'scroll_x' => false,
                'scroll_y' => '',
                'searching' => true,
                'state_save' => false,
                'delay' => 0,
                'extensions' => array()
            ));
     
            $this->ajax->set(array(
                'url' => $this->router->generate('acteur_results'),
                'type' => 'GET'
            ));
     
            $this->options->set(array(
                'display_start' => 0,
                'defer_loading' => -1,
                'dom' => 'lfrtip',
                'length_menu' => array(10, 25, 50, 100),
                'order_classes' => true,
                'order' => array(array(0, 'asc')),
                'order_multi' => true,
                'page_length' => 10,
                'paging_type' => Style::FULL_NUMBERS_PAGINATION,
                'renderer' => '',
                'scroll_collapse' => false,
                'search_delay' => 0,
                'state_duration' => 7200,
                'stripe_classes' => array(),
                'class' => Style::BOOTSTRAP_3_STYLE,
                'individual_filtering' => false,
                'individual_filtering_position' => 'head',
                'use_integration_options' => true,
                'force_dom' => false
            ));
     
            $this->columnBuilder
                ->add('id', 'column', array(
                    'title' => 'Id',
                ))
                ->add('nom', 'column', array(
                    'title' => 'Nom',
                ))
                ->add('prenom', 'column', array(
                    'title' => 'Prenom',
                ))
                ->add('dateNaissance', 'column', array(
                    'title' => 'DateNaissance',
                ))
                ->add('sexe', 'column', array(
                    'title' => 'Sexe',
                ))
                ->add(null, 'action', array(
                    'title' => $this->translator->trans('datatables.actions.title'),
                    'actions' => array(
                        array(
                            'route' => 'acteur_show',
                            'route_parameters' => array(
                                'id' => 'id'
                            ),
                            'label' => $this->translator->trans('datatables.actions.show'),
                            'icon' => 'glyphicon glyphicon-eye-open',
                            'attributes' => array(
                                'rel' => 'tooltip',
                                'title' => $this->translator->trans('datatables.actions.show'),
                                'class' => 'btn btn-primary btn-xs',
                                'role' => 'button'
                            ),
                        ),
                        array(
                            'route' => 'acteur_edit',
                            'route_parameters' => array(
                                'id' => 'id'
                            ),
                            'label' => $this->translator->trans('datatables.actions.edit'),
                            'icon' => 'glyphicon glyphicon-edit',
                            'attributes' => array(
                                'rel' => 'tooltip',
                                'title' => $this->translator->trans('datatables.actions.edit'),
                                'class' => 'btn btn-primary btn-xs',
                                'role' => 'button'
                            ),
                        )
                    )
                ))
            ;
        }
     
        /**
         * {@inheritdoc}
         */
        public function getEntity()
        {
            return 'datatbBundle\Entity\Acteur';
        }
     
        /**
         * {@inheritdoc}
         */
        public function getName()
        {
            return 'acteur_datatable';
        }
    }
    service.yml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
        app.datatable.post:
            class: datatbBundle\Datatables\ActeurDatatable
            parent: sg_datatables.datatable.abstract
    Acteur Entitie:
    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
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    <?php
    /**
     * Created by PhpStorm.
     * User: STG
     * Date: 22/08/2016
     * Time: 13:04
     */
     
    namespace datatbBundle\Entity;
    use Doctrine\ORM\Mapping as ORM;
    use Symfony\Component\Validator\Constraints as Assert;
    /**
     * @ORM\Entity
     */
    class Acteur
    {
        /**
         * @ORM\GeneratedValue
         * @ORM\Id
         * @ORM\Column(type="integer")
         */
        private $id;
     
        /**
         * @ORM\Column(type="string",length=255)
         * @Assert\NotBlank()
         */
        private $nom;
     
        /**
         * @ORM\Column(type="string",length=255)
         * @Assert\NotBlank()
         */
        private $prenom;
     
        /**
         * @ORM\Column(type="date")
         * @Assert\NotBlank()
         */
        private $dateNaissance;
     
        /**
         * @ORM\Column(type="string",length=1)
         * @Assert\NotBlank()
         * @Assert\Choice(choices = {"M", "F"})
         */
        private $sexe;
     
        /**
         * Get id
         *
         * @return integer 
         */
        public function getId()
        {
            return $this->id;
        }
     
        /**
         * Set nom
         *
         * @param string $nom
         * @return Acteur
         */
        public function setNom($nom)
        {
            $this->nom = $nom;
     
            return $this;
        }
     
        /**
         * Get nom
         *
         * @return string 
         */
        public function getNom()
        {
            return $this->nom;
        }
     
        /**
         * Set prenom
         *
         * @param string $prenom
         * @return Acteur
         */
        public function setPrenom($prenom)
        {
            $this->prenom = $prenom;
     
            return $this;
        }
     
        /**
         * Get prenom
         *
         * @return string 
         */
        public function getPrenom()
        {
            return $this->prenom;
        }
     
        /**
         * Set dateNaissance
         *
         * @param \DateTime $dateNaissance
         * @return Acteur
         */
        public function setDateNaissance($dateNaissance)
        {
            $this->dateNaissance = $dateNaissance;
     
            return $this;
        }
     
        /**
         * Get dateNaissance
         *
         * @return \DateTime 
         */
        public function getDateNaissance()
        {
            return $this->dateNaissance;
        }
     
        /**
         * Set sexe
         *
         * @param string $sexe
         * @return Acteur
         */
        public function setSexe($sexe)
        {
            $this->sexe = $sexe;
     
            return $this;
        }
     
        /**
         * Get sexe
         *
         * @return string 
         */
        public function getSexe()
        {
            return $this->sexe;
        }
    }

  2. #2
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Novembre 2013
    Messages
    739
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Novembre 2013
    Messages : 739
    Points : 1 022
    Points
    1 022
    Par défaut
    montre nous l'exception que tu rencontre .
    Si tu utilise firebug .. ou même l'onglet network en bas du navigateur.

  3. #3
    Membre à l'essai
    Homme Profil pro
    développeur android
    Inscrit en
    Avril 2016
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : Maroc

    Informations professionnelles :
    Activité : développeur android
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Avril 2016
    Messages : 12
    Points : 13
    Points
    13
    Par défaut y a pas d erreur la page reste en chargement et elle reste comme ca
    ..

  4. #4
    Membre éprouvé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Novembre 2013
    Messages
    739
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Novembre 2013
    Messages : 739
    Points : 1 022
    Points
    1 022
    Par défaut
    tu as utilisé firebug ou l'onglet network ?
    sinon ,apres avoir vider le fichier log montre nous son contenu suite a ce chargement.

  5. #5
    Membre à l'essai
    Homme Profil pro
    développeur android
    Inscrit en
    Avril 2016
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : Maroc

    Informations professionnelles :
    Activité : développeur android
    Secteur : Associations - ONG

    Informations forums :
    Inscription : Avril 2016
    Messages : 12
    Points : 13
    Points
    13
    Par défaut merci j ai résolu mon probleme
    ..

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. probleme d'integration du Bundle swe DataTables
    Par said.lakhili dans le forum Symfony
    Réponses: 2
    Dernier message: 23/08/2016, 13h28
  2. probleme interface implements
    Par inquire dans le forum Langage
    Réponses: 3
    Dernier message: 07/11/2007, 20h24
  3. Réponses: 9
    Dernier message: 15/10/2007, 11h20
  4. [ActionListener] probleme d'implementation
    Par sebpsi dans le forum AWT/Swing
    Réponses: 3
    Dernier message: 01/04/2007, 14h58
  5. Réponses: 2
    Dernier message: 20/09/2006, 14h20

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