Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Individual Column Filter #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ikarius6
Copy link
Contributor

After updating to last version of IgnitedDatatables, the useful plugin "ColumnFilter" stop working, so we can recovery the filter functions with:

var mytable = $('#mytable').DataTable({
... //server_side config
});

$('#mytable tfoot th').each( function () {
    var title = $('#mytable thead th').eq( $(this).index() ).text();
    $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
});

mytable.columns().eq( 0 ).each( function ( colIdx ) {
    $( 'input', mytable.column( colIdx ).footer() ).on( 'keyup change', function () {
        mytable
            .column( colIdx )
            .search( this.value )
            .draw();
    });
});

And the code is not invasive, you can filter with search input and be more specific with individual column search inputs.

Motivation: https://datatables.net/forums/discussion/comment/64034/#Comment_64034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant