How can I get alternative pagination working with the initialization of editor?

How can I get alternative pagination working with the initialization of editor?

AlexDTablesAlexDTables Posts: 19Questions: 3Answers: 0
edited September 2016 in Free community support

I have tried different ways, but if I write on of these code snippets, I always get the error messages ".. Cannot reinitialise Editor..."

// OPTION A

$(document).ready(function() {
    $('#contactos').DataTable( {
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]

    } );
} );

// OR OPTION B

$(document).ready(function() {
    $('#example').DataTable( {
        "pagingType": "full_numbers"
    } );
} );

// OPTION C
// Right now I'm trying with following code, but nothing happens:

var table2 = $('#contactos').DataTable( {
        'pagingType':'full_numbers',  // Is here the right place for the pagging type?
        dom: 'Bfrtip',
        ajax: 'php/table.contactos.php',
        columns: [
            {
                "data": "contactos.nombre"
            },
            {
                "data": "contactos.telefono_fijo"
            },
            {
                "data": "contactos.telefono_cel"
            },
            {
                "data": "contactos.email"
            },
            {
                "data": "clientes.nombre_comercial"
            }
        ],
        select: true,
        lengthChange: true,
        buttons: [
            { extend: 'create', text: "Nuevo", editor: editor },
            { extend: 'edit', text:"Editar", editor: editor },
            { extend: 'remove', text:"Eliminar", editor: editor }
        ]
    } );

Please help on get the alternative paggination for my tables.
Thanks in advance!

Replies

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin
    edited September 2016

    Do you mean, "Cannot reinitialise DataTables" (rather than Editor)? If so, please see this document. Basically you need to combine your individual initialisation blocks into one. There is an example in the documentation.

    Allan

  • allanallan Posts: 63,813Questions: 1Answers: 10,517 Site admin

    I should also comment on this bit:

    // Is here the right place for the pagging type?

    Yes it is. If that isn't working for you, please link to a test case showing the issue.

    Allan

  • AlexDTablesAlexDTables Posts: 19Questions: 3Answers: 0

    Ok, It was only necessary to remove the following line:

    dom: 'Bfrtip',
    
This discussion has been closed.