How to prevent an object array retrieved from the database from being displayed....

How to prevent an object array retrieved from the database from being displayed....

aeronmen2aeronmen2 Posts: 1Questions: 1Answers: 0

How to prevent an object array retrieved from the database from being displayed before it is passed to DataTables and displayed on the view?

$(document).ready(function(){ $('#exemple').DataTable(); } ); <?php for ($i = 0; $i < count($listemedecin); $i++) { ?> <?php } ?>
Identifiant Nom Prénom Adresse Téléphone Spécialité Département
<?php echo "<p>".$listemedecin[$i]->getidmedecin()."";?> <?php echo "<p>".$listemedecin[$i]->getnommedecin()."

";?>

<?php echo "<p>".$listemedecin[$i]->getprenommedecin()."

";?>

<?php echo "<p>".$listemedecin[$i]->getadressemedecin()."

";?>

<?php echo "<p>".$listemedecin[$i]->gettelmedecin()."

";?>

<?php echo "<p>".$listemedecin[$i]->getspecialitecomplementaire()."

";?>

<?php echo "<p>".$listemedecin[$i]->getdepartement()."

";?>

Modifier

Hello, I've been trying to resolve this case all morning.. So, I've used DataTables to show the data from my database and print the table with pagination, search etc.. But as you can see in the first image when I click on the button to go to the view, first(image2) it shows all the data (1000+ information) and after (image3) it shows the table with everything. I would like for my website to not print what we see in the second image and I can't find a way to do it... It's like the table is waiting for all the data to be retrieve for him to be printed.

image1:https://i.stack.imgur.com/CkLj2.jpg

image2:https://i.stack.imgur.com/3Fcfp.jpg

image3:https://i.stack.imgur.com/WnkAi.png

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    edited October 2021 Answer ✓

    You can hide the table or div or whatever is appropriate for your page to hide HTML table until Datatables initializes. Use initComplete to unhide the hidden element with Jquery or your preferred method.

    Kevin

Sign In or Register to comment.