Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.09k stars 886 forks source link

FixedHeader datatable's plugin not working #1220

Closed dmarcos89 closed 6 years ago

dmarcos89 commented 6 years ago

Bug report

Hi, im trying to include the fixed header plugin for data tables but not working.. Any idea? Thanks!

What I did:

In resources/views/vendor/backpack/crud/list.blade.php:


@section('after_styles'):
<link href="{{ asset('vendor/adminlte/plugins/datatables/extensions/FixedHeader/css/dataTables.fixedHeader.min.css') }}" rel="stylesheet" type="text/css" />

and 

@section('after_scripts')
<script src="{{ asset('vendor/adminlte/plugins/datatables/extensions/FixedHeader/js/dataTables.fixedHeader.min.js') }}" type="text/javascript"></script>

Then:

var table = $("#crudTable").DataTable({
        "pageLength": {{ $crud->getDefaultPageLength() }},
        /* Disable initial sort */
        "aaSorting": [],
        fixedHeader: true,
        "language": {
...
...
..

Backpack, Laravel:

lloy0076 commented 6 years ago

"Not working" is somewhat too generic.

Any chance there are any logs (from the browser console or laravel logs or web server logs)?

dmarcos89 commented 6 years ago

Receiving nothing, no console logs nor laravel logs...

dmarcos89 commented 6 years ago

Started using cdn links instead of /vendor ones and works. https://stackoverflow.com/questions/40361437/datatable-fixed-header-not-working

lloy0076 commented 6 years ago

I don't usually reopen issues however I think you're saying that:

  1. There is a fixed header module included in vendor (somewhere); and
  2. It doesn't work if included.

Which sounds like a bug to me.

Am I right?

dmarcos89 commented 6 years ago

Yes, updating this:

<link href="{{ asset('vendor/adminlte/plugins/datatables/extensions/FixedHeader/css/dataTables.fixedHeader.min.css') }}" rel="stylesheet" type="text/css" />
<script src="{{ asset('vendor/adminlte/plugins/datatables/extensions/FixedHeader/js/dataTables.fixedHeader.min.js') }}" type="text/javascript"></script>

to this:

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.2/css/fixedHeader.dataTables.min.css">
<script src="https://cdn.datatables.net/fixedheader/3.1.2/js/dataTables.fixedHeader.min.js" type="text/javascript"></script>

..make it work.

might be the version of those files? I don't have much time to test now, but let me know if i can help.

thanks

tabacitu commented 6 years ago

Thank you for sharing your solution @dmarcos89 !

dmarcos89 commented 6 years ago

@tabacitu You're welcome!😀 Awesome work by the way!!! 💪 Planning to migrate to Bootstrap4 anytime soon? Glad to help once i have a little time.

tabacitu commented 6 years ago

Of course. It depends a lot on AdminLTE - if they upgrade to Bootstrap 4, we can do that by supporting the latest AdminLTE version. If they don't, we might have to switch to CoreUI or something else that supports bootstrap4... Either way, it's a huge breaking change - a lot of blade files will change - so we'll probably do that for the next big version (backpack 4). I don't expect this to happen sooner than Q3 2018.