Comming from the base style, changed to bootstrap 5 and my rows doesn't have any style

Comming from the base style, changed to bootstrap 5 and my rows doesn't have any style

DosorioDosorio Posts: 3Questions: 2Answers: 0
edited February 2022 in DataTables

I'm not an expert, so I'm kind lost here.

This is my base html links

    <!-- Datatable script -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
    <script src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.js" type="text/javascript" charset="utf8"></script>
    <script src="https://cdn.datatables.net/1.11.4/js/dataTables.bootstrap5.min.js"></script>

    <!-- Datatable css -->
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap5.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/css/bootstrap.min.css">

Also, I'm using Laravel 8

I'm missing something else?

<div class="card">
        <div class="card-body">
            <table id="packagesTable">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Etapa</th>
                        <th>Productor</th>
                        <th>Variedad</th>
                        <th>Bandejas</th>
                        <th>Fecha inicio</th>
                        <th>Fecha termino</th>
                        <th>Fecha registro</th>
                        <th>Acciones</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($data as $key => $package)
                        the content
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>

This question has an accepted answers - jump to answer

Answers

  • DosorioDosorio Posts: 3Questions: 2Answers: 0
    edited February 2022

    This is a recreatin of what i'm working with

    http://live.datatables.net/soleparu/1/

  • sinfuljoshsinfuljosh Posts: 25Questions: 0Answers: 5
    Answer ✓

    @Dosorio It looks like the table is missing bootstrap classes.

    taken from https://datatables.net/examples/styling/bootstrap5.html

    <table id="example" class="table table-striped" style="width:100%">
    
  • sinfuljoshsinfuljosh Posts: 25Questions: 0Answers: 5

    Also you are missing css and js for bootstrap I think.
    If you use the downloader ( https://datatables.net/download/index ) you can pick the plugins you want to include.

    At the bottom you can uncheck the concatenate to get the itemized list of files needed. Here is a list of some of the essentials.

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.4/css/dataTables.bootstrap5.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.2.2/css/buttons.bootstrap5.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/datetime/1.1.1/css/dataTables.dateTime.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/2.2.9/css/responsive.bootstrap5.min.css"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.3.4/css/select.bootstrap5.min.css"/>
     
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/js/bootstrap.bundle.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.11.4/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.11.4/js/dataTables.bootstrap5.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.2/js/dataTables.buttons.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.bootstrap5.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.colVis.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.html5.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/buttons/2.2.2/js/buttons.print.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/datetime/1.1.1/js/dataTables.dateTime.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.9/js/dataTables.responsive.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/responsive/2.2.9/js/responsive.bootstrap5.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/select/1.3.4/js/dataTables.select.min.js"></script>
    
  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    It's worth using the Download page, as you can choose all the extensions and styling you need, and the links/files are generated with dependencies in mind,

    Colin

Sign In or Register to comment.