Bonjour à tous,
Je souhaite afficher un "Datepicker" dans mon tableau de données php qui aura pour fonction de sélectionner et filtrer mes données par date(champs DATEC).
Cependant, je n'arrive pas à afficher le widget sur ma page.
Voici mon code :
<!DOCTYPE html> <html> <head> <title>Programme du jour</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <script type="text/javascript" src="jquery-1.12.0.js"></script> <link rel="stylesheet" type="text/css" href="jquery.dataTables.min.css" /> <script type="text/javascript" src="jquery.dataTables.min.js"></script> <script type="text/javascript" src="jquery.dataTables.columnFilter.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#menuTable').DataTable( { "scrollY": "400px", "scrollCollapse": true, "paging":false, } ); } ); </script> <script type="text/javascript"> $(document).ready(function(){ $('#menuTable').dataTable().columnFilter({ sPlaceHolder: "head:before", aoColumns: [{ type: "date-range" }, null, null, { type: "select" }, null, null, null, { type: "select" }, { type: "select" }, null, null, null, null ] }); $("#datepicker").datepicker(); $.datepicker.regional[""].dateFormat = 'yyyy-mm-dd'; $.datepicker.setDefaults($.datepicker.regional['']); }); </script> </head> <body> <?php $serveur="localhost"; $login="root"; $pass=""; try{ $connexion=new PDO("mysql:host=$serveur;dbname=pegasedb",$login, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); $connexion->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $coursesSP=$connexion->query("SELECT DATEC, NUMR, NUMC, HIPPODROME, TITRE, SSPECIALITE, NBPAR, LIBPARI, NCH, PRONOSTIC, RESULTAT, SOLBASE FROM courses JOIN strategiesappliquees on (courses.IDCOURSE = strategiesappliquees.IDCOURSE) ORDER BY NUMR"); $coursesSP->setFetchMode(PDO::FETCH_OBJ); } Catch(PDOException $e){ echo 'echec: '.$e->getMessage(); } ?> <div> <table style="width:auto; font-size:50%" border="0" cellpadding="0" cellspacing="0" class="display" id="menuTable"> <thead> <tr class="selectREU"> <th align="left"></th> <th align="left"></th> <th align="left"></th> <th align="left">Selectionnez une réunion</th> <th align="left"></th> <th align="left"></th> <th align="left"></th> <th align="left">Pari</th> <th align="left"></th> <th align="left"></th> <th align="left"></th> <th align="left"></th> <th align="left"></th> </tr> <tr class="EnteteP"> <th align="left">Date</th> <th align="left">Reunion</th> <th align="left">Courses</th> <th align="left">Hippodrome</th> <th align="left">Titre</th> <th align="left">Discipline</th> <th align="left">Partants</th> <th align="left">Pari</th> <th align="left">En</th> <th align="left">Pronostic</th> <th align="left">Arrivée</th> <th align="left">Rapports</th> <th align="left">Solde</th> </tr> </thead> <tbody> <?php While($resultat = $coursesSP->fetch() ) { ?> <tr> <td><?php echo $resultat->DATEC ;?></td> <td><?php echo $resultat->NUMR ;?></td> <td><?php echo $resultat->NUMC ;?></td> <td><?php echo $resultat->HIPPODROME ;?></td> <td><?php echo $resultat->TITRE;?></td> <td><?php echo $resultat->SSPECIALITE;?></td> <td><?php echo $resultat->NBPAR;?></td> <td><?php echo $resultat->LIBPARI;?></td> <td><?php echo $resultat->NCH;?></td> <td><?php echo $resultat->PRONOSTIC;?></td> <td><?php echo $resultat->RESULTAT;?></td> <td><?php echo "";?></td> <td><?php echo $resultat->SOLBASE;?></td> </tr> <?php } $coursesSP->closeCursor(); ?> </tbody> <tfoot> </tfoot> </table> </div> </body> </html>
Des idées ?
Merci d'avance.
Afficher la suite