stwe / DatatablesBundle

This Bundle integrates the jQuery DataTables plugin into your Symfony application.
355 stars 236 forks source link

Pagination Bootstrap 4 #918

Closed DylanDelobel closed 5 years ago

DylanDelobel commented 5 years ago

Hi,

I just installed the bundle and everything is working great except the pagination styling

Here is my header

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.12/b-1.2.2/b-colvis-1.2.2/b-flash-1.2.2/b-html5-1.2.2/b-print-1.2.2/fc-3.2.2/fh-3.1.2/r-2.1.0/datatables.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">

Datatables config

$this->features->set(array(
    'info' => false,
    'searching' => false,
    'length_change' => false,
    'auto_width' => true,
    'processing' => true,
    'ordering' => false,
));

$this->options->set(array(
    'classes' => Style::BOOTSTRAP_4_STYLE,
    'paging_type' => Style::FULL_NUMBERS_PAGINATION,
    'page_length' => 2,
    'dom' => 'rtip'
));

Here the result pagination

Not sure if I've missed a thing but the HTML output does not look like the BS4 Documentation

I got this

<div class="dataTables_paginate paging_full_numbers">
  <ul class="pagination">
    <li class="paginate_button first disabled">
    ...
DylanDelobel commented 5 years ago

It was more simple than I thought

If you use BS4 they got a different js file, I replaced

<script src="https://cdn.datatables.net/v/bs/jszip-2.5.0/pdfmake-0.1.18/dt-1.10.12/b-1.2.2/b-colvis-1.2.2/b-flash-1.2.2/b-html5-1.2.2/b-print-1.2.2/fc-3.2.2/fh-3.1.2/r-2.1.0/datatables.min.js"></script>

from the installation doc to

<script src="https://cdn.datatables.net/v/bs4/dt-1.10.18/datatables.min.js"></script>

Found through the Datatables Builder

What about adding a little note in the documentation for BS4 users?