Dom problem

Dom problem

antoniocibantoniocib Posts: 277Questions: 62Answers: 1

Hi guys, i add SearchPanes to my table but i've already use

dom: 'Bfrtip'

and now i add:

dom: 'Pfrtip' (for work the Search Panes)

But it no longer work dom:'Bfrtip'

This is the code:

/*
* Editor client script for DB table scrivania1
* Created by http://editor.datatables.net/generator
*/

(function($){

$(document).ready(function() {

$.fn.dataTable.moment('DD/MM/YYYY');




var editor = new $.fn.dataTable.Editor( {
    ajax: 'php/table.scrivania1.php',
    table: '#scrivania1',





    fields: [
        {
            "label": "DDT/ORDINE nĀ°:",
            "name": "ddt"
        },
        {
            "label": "Cliente:",
            "name": "cliente"
        },
        {
            "label": "Magazzino Carico:",
            "name": "carico"
        },
        {
            "label": "Destinazione:",
            "name": "destinazione"
        },
        {
            "label": "PR:",
            "name": "pr"
        },
        {
            "label": "Magazzino Scarico:",
            "name": "scarico"
        },
        {
            "label": "Data di scarico:",
            "name": "data_di_scarico",
            "type": "datetime",
            "format": "DD/MM/YYYY"
        },
        {
            "label": "EPAL:",
            "name": "epal"
        },
        {
            "label": "IND:",
            "name": "ind"
        },
        {
            "label": "PERD:",
            "name": "perd"
        },
        {
            "label": "Dati di scarico:",
            "name": "dati_di_scarico"
        },
        {
            "label": "Autista Ritiro:",
            "name": "drit"
        },
        {
            "label": "Targa Ritiro:",
            "name": "trit"
        },
        {
            "label": "Autista Linea:",
            "name": "dlinea"
        },
        {
            "label": "Targa Linea:",
            "name": "tlinea"
        },
        {
            "label": "Note:",
            "name": "note"
        },
        {
                    label:     "Conferma:",
                    name:      "active",
                    type:      "checkbox",
                    separator: "|",
                    options:   [
                        { label: '', value: 1 }
                    ]
                }

],

i18n: {
create: {
button: "Nuova Spedizione",
title: "Inserisci una nuova spedizione",
submit: "Conferma",

},
edit: {
button: "Modifica Spedizione",
title: "Modifica Spedizione",
submit: "Conferma"
},
remove: {
button: "Elimina Spedizione",
title: "Elimina Spedizione",
submit: "Elimina",
confirm: {
_: "Sei sicuro di voler eliminare %d riga?",
1: "Sei sicuro di voler eliminare questa riga?"
}
},
error: {
system: "Errore di sistema, contattare lo sviluppatore"
},
datetime: {
previous: 'Precedente',
next: 'Successivo',
months: [ 'Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre' ],
weekdays: [ 'Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab' ]
}

}
} );
/*
var table = $('#scrivania1').DataTable({
dom: 'Plftrip',
searchPanes:{
columns:[1,2,3,5]

},

});*/

var table = $('#scrivania1').DataTable( {
//  serverSide: 'true',
    dom: 'Bfrtip',
//  dom: 'Pfrtip',
    ajax: 'php/table.scrivania1.php',
    order: [5, 'desc'],


    columns: [




        {
            "data": "ddt"
        },
        {
            "data": "cliente"
        },
        {
            "data": "carico"
        },
        {
            "data": "destinazione"
        },
        {
            "data": "pr"
        },
        {
            "data": "scarico"
        },
        {
            "data": "data_di_scarico"
        },
        {
            "data": "epal"
        },
        {
            "data": "ind"
        },
        {
            "data": "perd"
        },
        {
            "data": "dati_di_scarico"
        },
        {
            "data": "drit"
        },
        {
            "data": "trit"
        },
        {
            "data": "dlinea"
        },
        {
            "data": "tlinea"
        },
        {
            "data": "note"
        },

        {
            "data": "active",
                render: function ( data, type, row ) {
                        if ( type === 'display' ) {
                                return '<input type="checkbox" class="editor-active" >';
                        }
                        return data;
                },
            className: "dt-body-center",

        }

],

/*createdRow: function ( row, data, index ) {
        if ( data.active == 1 ) {
                $('tr', row).eq(11).addClass('highlight')
        }
    },

*/

searchPanes:{
columns:[7,8,9]

},

select: {
        style: 'os',
        selector: 'td:not(:last-child)' // no row selection on last column
},
//  ],

// select: true,
// lengthChange: true,

lengthMenu: [
[10, 20, 25, 50, -1],
[10 , 20, 25, 50, 'Tutte']
],
buttons: [

        { extend: 'create', editor: editor, text: 'Nuova Spedizione'},
        { extend: 'edit',   editor: editor, text: 'Modifica Spedizione' },
        { extend: 'remove', editor: editor, text: 'Elimina Spedizione' },
        { extend: 'excelHtml5', exportOptions: {

columns: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ,
modifier: {
page: 'current'
}
}
},

        {extend: 'pageLength', editor: editor, text:'Mostra righe'}


    ],

    rowCallback: function ( row, data ) {                                                                                                                                           //SCRIPT PER RITORNARE LE RIGHE EVIDENZIATE
            // Set the checked state of the checkbox in the table
            $('input.editor-active', row).prop( 'checked', data.active == 1 );
        if ( data.active == 1 ) {
                    $(row).addClass('myHighlight')
        }
     else {
            $(row).removeClass('myHighlight')
    }
    },

    footerCallback: function ( row, data, start, end, display ) {                                                                                                   // SOMMA PER PEDANE
            var api = this.api(), data;

            var intVal = function ( i ) {
                    return typeof i === 'string' ?
                            i.replace(/[\$,]/g, '')*1 :
                            typeof i === 'number' ?
                                    i : 0;
            };

            // Total over this page
            pageTotal = api
                    .column( 7, { page: 'current'} )
                    .data()
                    .reduce( function (a, b) {
                            return intVal(a) + intVal(b);
                    }, 0 );

            // Update footer
            $( api.column( 7 ).footer() ).html(
                    pageTotal
            );
            pageTotal = api
                    .column( 8, { page: 'current'} )
                    .data()
                    .reduce( function (a, b) {
                            return intVal(a) + intVal(b);
                    }, 0 );

            // Update footer
            $( api.column( 8 ).footer() ).html(
                    pageTotal
            );
            pageTotal = api
                    .column( 9, { page: 'current'} )
                    .data()
                    .reduce( function (a, b) {
                            return intVal(a) + intVal(b);
                    }, 0 );

            // Update footer
            $( api.column( 9 ).footer() ).html(
                    pageTotal
            );
    },





    language: {
    select: {
            rows: {
                _: "%d righe selezionate",
                0: "",
                1: "1 riga selezionata"
            }
        },
    processing:     "Processando...",
    search:         "Cerca&nbsp;:",
    lengthMenu:     "Mostra _MENU_ spedizioni",
    info:           "Mostra _START_ a _END_ di _TOTAL_ spedizioni",
    infoEmpty:      "Mostra 0 su 0 di 0 spedizioni",
    infoFiltered:   "(Filtrato da _MAX_ totale spedizioni )",
    infoPostFix:    "",
    loadingRecords: "Caricamento in corso...",
    zeroRecords:    "Nessuna spedizione",
    emptyTable:     "Nessuna spedizione disponibile",
    paginate: {
            first:      "Prima",
            previous:   "Precedente",
            next:       "Successiva",
            last:       "Ultima"
    },
    aria: {
            sortAscending:  ": Attivare per ordinare la colonna in modo crescente",
            sortDescending: ": Attivare per ordinare la colonna in modo decrescente"
    }

}

} );

$('#scrivania1').on( 'click', 'tbody td', function (e) {                 //Editor per RIGHE 11 A 15
        if ( $(this).index() > 10 && $(this).index() < 16 ) {
                editor.bubble( this );
        }
});

$('#scrivania1').on( 'change', 'input.editor-active', function () {  //SCRIPT PER CHECKBOX RITIRO

         editor
                 .edit( $(this).closest('tr'), false )
                 .set( 'active', $(this).prop( 'checked' ) ? 1 : 0 )
                 .submit();


 } );

         $('#scrivania1 tfoot th').each( function () {                                                                                                                                                                      //SCRIPT PER RICERCA TFOOT
         var title = $(this).text();                                                                                                                                                                                                            //SCRIPT PER RICERCA TFOOT
         $(this).html( '<input type="text"  style="text-align:center ; width:100%" placeholder="'+title+'" />' );                                                   //SCRIPT PER RICERCA TFOOT
 } );

 // DataTable
 var table = $('#scrivania1').DataTable();

 // Apply the search
 table.columns().every( function () {
         var that = this;

         $( 'input', this.footer() ).on( 'keyup change clear', function () {
                 if ( that.search() !== this.value ) {
                         that
                                 .search( this.value )
                                 .draw();
                 }
         } );
 } );

} );

}(jQuery));

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    edited March 2020 Answer āœ“

    Did you try dom: 'PBfrtip'? You can only have one dom option.

    Kevin

  • antoniocibantoniocib Posts: 277Questions: 62Answers: 1

    Works ty kevin!

This discussion has been closed.