javascript - Pushing content in tbody in Data table from php. Why is Datatable not able to keep thead fixed? -


my javascript code read data php is:

<script>  url = "new.php?table_name="+table_name;  getsuccessoutput(url);   function getsuccessoutput(url_received) {    getrequest(url_received, drawoutput, drawerror);    return false;  }   function drawoutput(responsetext) {     var container = document.getelementbyid('tbodyid');     $('#tbodyid').append(responsetext);  } </script> 

i fetching data new.php script , pushing on datatable in tbody using code:

$result = mysqli_query($con, $query1);  if(mysqli_num_rows($result)>0) {   while ($row=mysqli_fetch_row($result)) {     echo "<tr>        <td>" . $row[1]. "</td>        <td>" . $row[3]. "</td>        <td>" . $row[2]. "</td>        <td>" . $row[6]."</td>        </tr>";    } //while ends here }//if ends here 

my table code in html is:

<div id="table-div"  style="height:450px;overflow: auto;">   <table id="table-fixed" class="table table-striped"  style="border-collapse:separate;white-space:nowrap;text-align:center;" cellspacing="0">    <thead id="theadid" >     <tr>      <th>created_at</th>      <th>1temperature</th>      <th>2temperature</th>      <th>3temperature</th>     </tr>    </thead>    <tbody id="tbodyid">       <!-- nothing here. comes php -->    </tbody>   </table>  </div> 

this fetching data , appending data table well. why thead getting scrolled down datatable?

i using bootstrap 4 version. have referenced jsfiddle: http://jsfiddle.net/t9bhm/7/ not helping.

can assist me this?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -