Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Cannot reinitialise datatable #250

@giankotarola

Description

@giankotarola

I have a problem with data tables. I have 5 tables in differents tabs but with the same options and I use ng-repeat for show the information. I get the data with http request to the api.
Ex:

$scope.dtOptions = DTOptionsBuilder.newOptions()
        .withBootstrap()
        .withOption('rowCallback', rowCallback)
        .withOption('deferRender', false)
        .withOption('sDom', "<'row'<'col-md-6 hidden-xs'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>")
        .withOption('oLanguage', {
            "sLengthMenu": "_MENU_",
            "sInfo": "Mostrando <strong>_START_ a _END_</strong> de _TOTAL_ entradas"
        })
        .withOption('sPaginationType', "bootstrap")
        .withOption('oClasses', {
            "sFilter": "pull-right",
            "sFilterInput": "form-control input-rounded ml-sm",
            "sWrapper": "dataTables_wrapper form-inline",
            "sLength": "dataTables_length blahblahcar"
        })
        .withOption('initComplete', function(){
            //bad but creating a separate directive for demo is stupid
            $(".dataTables_length select").selectpicker({
                width: 'auto'
            });
        });
    $scope.dtColumnDefs = [
        DTColumnDefBuilder.newColumnDef(0),
        DTColumnDefBuilder.newColumnDef(1),
        DTColumnDefBuilder.newColumnDef(2),
        DTColumnDefBuilder.newColumnDef(3),
        DTColumnDefBuilder.newColumnDef(4),
        DTColumnDefBuilder.newColumnDef(5),
        DTColumnDefBuilder.newColumnDef(6).notSortable()
    ];

When I update a data from a table, one of the others tables have to update, because the data have to go there. But when finish to splice and push to other $scope variable(add the data to the other table) I have this error: Cannot reinitialise DataTable.
Can anyone help me?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions