Column Select filter doesnt use fontsize
Column Select filter doesnt use fontsize
georgeforster
Posts: 21Questions: 9Answers: 1
When I create a table, and use the css font-size to adjust the font size in the table, the header, body and footer change font size.
When I add the column filter by select to the table the font in those elements do not change to match the selected font-size
See http://flywestwind.org/AircraftScenery/AircraftListtest.php to show the results
Here is my javascript
<script>
$(document).ready(function() {
$('table.example').DataTable( {
initComplete: function () {
this.api().columns().every( function () {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo( $(column.footer()).empty() )
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
}
} );
$('#size').on( 'change', function () {
$('table.example').css( {
'font-size': this.value+'em',
'line-height': this.value+'em'
} );
} );
} );
</script>
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
select
elements are an utter pain to style. You need to addselect { font-size: inherit }
to your CSS.Allan
Thanks Allan
I changed my code to
and it worked like a charm