0

I am trying to display the data datatables , Tapo there is a problem , please help , for another dicode datatables can run successfully , but in this code do not want the road ? Uncaught TypeError: Cannot read property 'mData' of undefined

This JS

 <script src="<?php echo base_url('assets/js/jquery.dataTables.min.js') ?>" type="text/javascript"></script>
    <script src="<?php echo base_url('assets/js/dataTables.bootstrap.min.js') ?>" type="text/javascript"></script>
    <script>
        $(document).ready(function() {
            $('#files').DataTable();
        });

table class="table table-striped table-condensed" id="files">
                <thead>
                    <tr>
                        <th>File Name</th>
                        <th>Upload By</th>
                        <th>Upload Date</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
                     foreach($files as $f => $file){
                            foreach($permission as $p => $key){
                                if($key['id_files'] == $file['file_id'] ||$this->user->is_teacher || $this->user->is_superadmin ){
                                echo '<tr>';
                                echo '<td><a href="'.base_url('dropzone/global_download')."/".$file['file_id'].'">'.$file['file_name'].'</a></td>';
                                echo '<td>'.$file['upload_by'].'</td>';
                                echo '<td>'.date("d-M-Y",strtotime($file['upload_dt'])).'</td>';
                                echo '<td>';
                                if($this->user->is_teacher || $this->user->is_superadmin){
                                echo '<a href="'.base_url('dashboard/permission_file')."/".$file['file_id'].'"><i class="fa fa-user"></i> Manage </a>';
                                echo '</td>';
                                echo '<td>';
                                    echo '<a href="javascript:_delete_file('.$file['file_id'].');"><i class="fa fa-times"></i> Delete </a>';
                                }
                                echo '</td>';
                                echo '</tr>';
                            }
                            }
                        }
                 ?>
                </tbody>
            </table>
Iswadi
  • 87
  • 1
  • 1
  • 8
  • 2
    You need the same number of `` elements as `` elements in each row. – davidkonrad Jul 12 '16 at 07:23
  • @davidkonrad You should post that as an answer so it's more obvious for any future readers (even though it was such a minor change). – Chris H. Jul 12 '16 at 15:22
  • @ChrisH. - you are more than welcome to answer yourself :) If the question was tagged with javascript or jquery, _and_ OP had higher rep, I guess I would have closed it using the dupehammer (mjolnir) there is so many derivations over this question already. But you are right, if the question remain it certainly deserves an answer. – davidkonrad Jul 12 '16 at 15:45
  • Possible duplicate of [jQuery Datatables large data set Uncaught TypeError: Cannot read property 'mData' of undefined](http://stackoverflow.com/questions/33091881/jquery-datatables-large-data-set-uncaught-typeerror-cannot-read-property-mdata) – Chris H. Jul 12 '16 at 15:47

0 Answers0