1

Why my export buttons like PDF, EXCEL CSV not showing or displaying on my page?

here is what my table looks like

Imgur image of table

here are my js links

Imgur image of js links

    <table class="table" id="table_id">
        <thead>
          <tr>
            <th>EMPLOYEE NO.</th>
            <th>NAME</th>
            <th>DATE</th>
            <th>TIME IN</th>
            <th>TIME OUT</th>
            <th>TOTAL HOURS</th>
            <th>STATUS</th>

          </tr>
        </thead>
        <tbody>

                @foreach ($employeeSched as $setTime)
          <tr>
            <td><b>{{ $setTime->employee_no }}</b></td>
            <td><b>{{ $setTime->last_name }}, {{ $setTime->first_name }}</b></td>
             <td><b>{{Form::label('date_today', $setTime->date_today)}}</b></td>

             <td><input type="time" name="schedules[{{ $setTime->id }}][timeIn]" class="form-control col-md-11" value='{{ $setTime->time_in }}'></td>

            <td><input type="time" name="schedules[{{ $setTime->id }}][timeOut]" class="form-control col-md-11" value='{{ $setTime->time_out }}'></td>
            </td>
          </tr>
          @endforeach



        </tbody>
</table>

{{ $employeeSched->links() }}

and my Script

@section('script')


<script type="text/javascript">
 $(document).ready(function() {
   $('#table_id').DataTable({
       dom: 'Bfrtip',
       buttons: [
           'copy', 'csv', 'excel', 'pdf', 'print'
       ]
   });
});
</script>

and in my app.blade.php here are my links

links for scripts

{!! Html::script('js/datatable/dataTables.buttons.min.js') !!}
{!! Html::script('js/datatable/buttons.flash.min.js') !!}
{!! Html::script('js/datatable/jszip.min.js') !!}
{!! Html::script('js/datatable/pdfmake.min.js') !!}
{!! Html::script('js/datatable/vfs_fonts.js') !!}
{!! Html::script('js/datatable/buttons.html5.min.js') !!}
{!! Html::script('js/datatable/buttons.print.min.js') !!}

links for css

{!! Html::style('css/buttons.dataTables.min.css') !!}
{!! Html::style('css/jquery.dataTables.min.css') !!}
1
  • Is it showing any error in console ? Commented Feb 14, 2019 at 5:09

1 Answer 1

1

I think your datatable is not working.Because you have not the same number of <th> and <td>.Make same number of th and td tag.And also use bellow scripts serially as they appear.

https://code.jquery.com/jquery-3.3.1.js
https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js
https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js
https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js
https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js
https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js
https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js

css

https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css
https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css

and your script:

@section('script')


<script type="text/javascript">
 $(document).ready(function() {
   $('#table_id').DataTable({
       dom: 'Bfrtip',
       buttons: [
           'copyHtml5','excelHtml5','csvHtml5','pdfHtml5','print'
       ]
   });
});
</script>
@endsection

Sign up to request clarification or add additional context in comments.

1 Comment

Hello, I am having the same issue here, did you get a solution? Kindly share

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.