language and scroll in search function

language and scroll in search function

grahn195grahn195 Posts: 2Questions: 1Answers: 0
edited August 2016 in Free community support

Hello Guys!

how can i add the language and scrollY with full worked search in this code??

$(document).ready(function() {
    // Setup - add a text input to each footer cell
    $('#example tfoot th').each( function () {
        var title = $(this).text();
        $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
    } );
 
    // DataTable
    var table = $('#example').DataTable();
 
    // Apply the search
    table.columns().every( function () {
        var that = this;
 
        $( 'input', this.footer() ).on( 'keyup change', function () {
            if ( that.search() !== this.value ) {
                that
                    .search( this.value )
                    .draw();
            }
        } );
    } );
} );

//Example code Language & scrollY

$('#example').DataTable( { "language": { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/German.json" }, scrollY: '50vh', scrollCollapse: true, paging: false } );
https://jsfiddle.net/sbqLe2v3/

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin
    Answer ✓

    Do the filter initialisation inside initComplete. See the language.url reference for why this is required.

    Allan

  • grahn195grahn195 Posts: 2Questions: 1Answers: 0

    didnt work!

    https://jsfiddle.net/sbqLe2v3/1/

    Uncaught SyntaxError: Unexpected identifier

  • allanallan Posts: 63,812Questions: 1Answers: 10,516 Site admin

    Your code contains a syntax error as the console error is saying. There is a missing comma at the end of the paging: 'false' line.

    Also, that should be paging: false (i.e. not a string). See paging for full documentation.

    Allan

This discussion has been closed.