Open sabas opened 10 years ago
I couldn't find a way in the dataTables docs to add a custom class to a form element.
However, you can add form-group to the <div>
s that wrap these elements:
"sDom": "<'row'<'col-sm-12'<'pull-right form-group'f><'pull-left form-group'l>r<'clearfix'>>>t<'row'<'col-sm-12'<'pull-left'i><'pull-right'p><'clearfix'>>>",
Then, you need to somehow add form-control
to the input
and select
elements. One way to do this is by using jQuery. Another, if you're using your Bootstrap with Sass, is using the @extend
feature:
.dataTables_filter, .dataTables_length {
input, select {
@extend .form-control;
}
}
Nice, I changed the sDom in datatables.js as you suggested and after .datatable() call I added
$('.dataTables_filter input,.dataTables_length select').addClass('form-control input-sm inline-block');
IMHO should be applied to input boxes (search and filters for example)