davejal
davejal

Reputation: 6133

Using tabletools with AdminLTE in Laravel

I finally used AdminLTE and got datatables to work, but now I want to add tabletools also.

I installed using this

  1. laravel new laravel-with-admin-lte
  2. cd laravel-with-admin-lte
  3. adminlte-laravel install

Then I edited the scripts.blade.php to add the scripts (not sure if this is correct but it works:

<script src="{{ asset('/plugins/datatables/jquery.dataTables.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('/plugins/datatables/dataTables.bootstrap.min.js') }}" type="text/javascript"></script>
<script src="{{ asset('/plugins/datatables/extensions/TableTools/dataTables.tableTools.js') }}" type="text/javascript"></script>

<script>
  $(function () {
    $("#example2").DataTable();
    $('#example1').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "dom": 'T<"clear">lfrtip',
        "tableTools": {
            "sSwfPath": "/plugins/datatables/extensions/TableTools/swf/copy_csv_xls.swf"}
    });
  });
</script>

Then I added the following to my htmlheader.blade.php to include css:

<link href="{{ asset('/plugins/datatables/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('/plugins/datatables/jquery.dataTables.css') }}" rel="stylesheet" type="text/css" />

I want to be able to see the export options (xls,csv etc).

Should I add something to show these links (buttons) or is something wrong with how I implented tabletools?


Also tried to change:

"/plugins/datatables/extensions/TableTools/swf/copy_csv_xls.swf"

into

"../TableTools/swf/copy_csv_xls.swf"

Problem:

I don't see the buttons or links for exporting.

Upvotes: 1

Views: 3091

Answers (1)

zmunetsi
zmunetsi

Reputation: 1

Hi I would recommend you add it as a plugin in the config/adminlte.php. See documentation: https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Plugins-Configuration.

Upvotes: 0

Related Questions