Posted in

Datatables deshabilitar opción ordenar en algunas columnas

Usaremos una clase “no-sort” que añadiremos en los td de la cabecera que no queramos ordenar y le pasaremos unos parámetros junto a la llamada de la siguiente forma:

$('#datatable').dataTable({
            "columnDefs": [ {
                "targets": 'no-sort',
                "orderable": false,
            } ]
        });

HTML

<table id="datatable" class="table table-striped table-bordered">
                <thead>
                    <tr>
                        <th>{{ Lang::get('elements.name') }}</th>
                        <th>{{ Lang::get('elements.users') }}</th>
                        <th class="no-sort"></th>
                    </tr>
                </thead>
                <tbody>
...

Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *


The reCAPTCHA verification period has expired. Please reload the page.