'DATATABLE Cannot set properties of undefined (setting '_DT_CellIndex')

issue getting in datatable while i m using loop array Column are equal thead and tbody still getting issue. i m faching data from command and using array i want output in datatable.output is working but datable shorting and search option is not working.

<div class="m-t-25">
  <table id="data-table" class="table dataTable">
    <thead>
      <tr>
        <?php
        foreach ($output[0] as $clave=>$fila) {
          echo "<th>".$fila."</th>";
        }
        ?>
        <th>Action</th>
      </tr>
    </thead>
    <tbody>
    <?php
    $output = array_slice($output, 2); 
    foreach ($output as $fila) {
      echo "<tr>";
      foreach ($fila as $elemento) {
        echo "<td>".$elemento."</td>";
      }
      echo '<td><select class="act">';
      echo '<option value="watch" selected="">graph</option>';
      echo '</select></td>';
      echo "</tr>";
    } 
    ?>
  </tbody>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source