Datatables customize feature not working in Admin Lit

Datatables customize feature not working in Admin Lit

eems_developereems_developer Posts: 6Questions: 3Answers: 0
edited November 2019 in Free community support

I'm building a Laravel app with AdminLTE integrated in the backend. AdminLTE uses DataTables to generate the tables, this works fine. But in Admin LTE it's only possible to use common , and it's not possible to customize In one admin view I want to remove search, pageing and customize button . I've tried to integrate the example code in AdminLTE file main.js. But I haven't got it working. In main.js there is a codesnippet where probably the new code should or could be integrated.

My real code on the page

var tableaprim = $('adm_primary_tb').DataTable({
paging:false, bFilter : false,
'columnDefs': [ {orderable: false,
className: 'select-checkbox',
targets: 0
}

            ],
            'select': {
               style: 'multi',
               selector: 'td:first-child'
            }

});

_
i get customized

but error came

**DataTables warning: table id=adm_primary_tbl - Requested unknown parameter '1' for row 0. For more information about this error, please see http://datatables.net/tn/4
**

but i need change my code like this

var tableaprim = $('adm_primary_tb').DataTable({
paging:false, bFilter : false,
if ($(this).hasClass('dt-select')) {

'columnDefs': [ {orderable: false,
className: 'select-checkbox',
targets: 0
}

],
'select': {
style: 'multi',
selector: 'td:first-child'
}
}
});

**
the default table came
i cant customised **

above co not working

my default code in
file main.js

code
$('.datatable').each(function () {
if ($(this).hasClass('dt-select')) {
window.dtDefaultOptions.select = {
style: 'multi',
selector: 'td:first-child'
};

        window.dtDefaultOptions.columnDefs.push({
            orderable: false,
            className: 'select-checkbox',
            targets: 0
        });
    }
    $(this).dataTable(window.dtDefaultOptions);
});

$(document).on( 'init.dt', function ( e, settings ) {
    if (typeof window.route_mass_crud_entries_destroy != 'undefined') {
        $('.datatable, .ajaxTable').siblings('.actions').html('<a href="' + window.route_mass_crud_entries_destroy + '" class="btn btn-xs btn-danger js-delete-selected" style="margin-top:0.755em;margin-left: 20px;">'+window.deleteButtonTrans+'</a>');
    }
});

Answers

This discussion has been closed.