Customising the filter input field

Customising the filter input field

marceloverdijkmarceloverdijk Posts: 22Questions: 3Answers: 0
edited May 2013 in General
I'm using DataTables with Twitter Bootstap 2 as explained in the blog post and it's really nice.
The https://github.com/DataTables/Plugins/blob/master/integration/bootstrap/dataTables.bootstrap.js overrides the pagination object to determine how the paging markup will render.

Now I wonder if we can do the same for the filter input? Basically what I would like to do is:
- add class to input (class="search-query" from twitter bootstrap)
- add placeholder attribute

I read this post http://datatables.net/forums/discussion/7616/adding-placeholder-to-the-filter-text-input/p1 but I would like something more "generic". I will have multiple tables and thus input fields on pages so I'm looking for a smart way to customise the way DataTables renders the input box.

Replies

  • marceloverdijkmarceloverdijk Posts: 22Questions: 3Answers: 0
    edited May 2013
    I ended up using this:

    [code]
    $(document).ready(function() {

    $('.dataTables_filter input').addClass('search-query');
    $('.dataTables_filter input').attr('placeholder', 'Search');
    ..
    [/code]
This discussion has been closed.