Customising the filter input field
Customising the filter input field
marceloverdijk
Posts: 22Questions: 3Answers: 0
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.
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.
This discussion has been closed.
Replies
[code]
$(document).ready(function() {
$('.dataTables_filter input').addClass('search-query');
$('.dataTables_filter input').attr('placeholder', 'Search');
..
[/code]