Current Path : /data/web/virtuals/51568/virtual/www/www/plany/ |
Current File : /data/web/virtuals/51568/virtual/www/www/plany/textyTydnySelect.php |
<?php $sql = "select pl_idtydne_dnes($idRok, $idTyden)"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_array($result, MYSQLI_NUM); $idTydenAktualni = $row[0]; $sql = "SELECT `id`, `idrok`, `cislo`, `zacatek` FROM `pl_tydny` WHERE idrok=$idRok"; $result = mysqli_query($conn, $sql); ?> <div id="tydny" class="table-scroll-container-40 mb-3 table-scroll" style="min-width: 180px;"> <div class="h5">Přiřaď týdny</div> <table class="table table-striped table-bordered table-sm "> <thead> <tr> <td>týden</td> <td>začátek</td> </tr> </thead> <?php while ($row = mysqli_fetch_object($result)) { $aktualni = ($row->id == $idTydenAktualni); ?> <tr <?php echo ($aktualni) ? "id='aktualni'" : ""; ?>> <td> <div class="custom-control custom-radio ml-1 pr-0"> <input type="checkbox" class="custom-control-input" id="cbTyden<?php echo $row->id; ?>" name="cbTyden" > <label class="custom-control-label" for="rgTydenZobr<?php echo $row->id; ?>"> <?php echo $row->cislo;?> </label> </div> </td> <td> <?php echo date('d.m.Y', strtotime($row->zacatek));?> </td> </tr> <?php } ?> </table> </div> <script> $(document).ready(function () { function NastavRadekTabulky (){ var tableContainer = $('#tydny'), row = $('#aktualni'); //tableContainer.scrollTop(220); tableContainer.scrollTop(0); if(row.length) { //tableContainer.scrollTop(row.offset().top - (tableContainer.height()/2)) tableContainer.scrollTop(row.offset().top - (tableContainer.height()/2)) } } NastavRadekTabulky (); }) </script>