1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-01 13:24:10 +01:00

New: sFilterInput and sLengthSelect class options for the <select> and

<input> controls used by DataTables for length change and filtering
respectively.

- Bootstrap 3 requires a styling class be set directly on the element,
  so in order to correctly support Bootstrap 3, which we want to do, we
  need to have the ability to set these classes. This commit adds that
  ability
This commit is contained in:
Allan Jardine 2013-10-09 14:57:45 +01:00
parent bef8374eed
commit c470d7bfda
2 changed files with 22 additions and 12 deletions

View File

@ -1 +1 @@
8583fb37f99549488c7d149a917459b1073aec01 e57b4f7b883e4da084a9ef3e277cafe4f121e245

View File

@ -2180,10 +2180,14 @@
{ {
var oPreviousSearch = oSettings.oPreviousSearch; var oPreviousSearch = oSettings.oPreviousSearch;
// @todo Surely this can be cleaned up!?!
var klass = 'class="'+oSettings.oClasses.sFilterInput+'"';
var sSearchStr = oSettings.oLanguage.sSearch; var sSearchStr = oSettings.oLanguage.sSearch;
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ? sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
sSearchStr.replace('_INPUT_', '<input type="search" />') : sSearchStr.replace('_INPUT_', '<input type="search" />') :
sSearchStr==="" ? '<input type="search" />' : sSearchStr+' <input type="search" />'; sSearchStr==="" ?
'<input type="search" '+klass+' />' :
sSearchStr+' <input type="search" '+klass+'/>';
var nFilter = document.createElement( 'div' ); var nFilter = document.createElement( 'div' );
nFilter.className = oSettings.oClasses.sFilter; nFilter.className = oSettings.oClasses.sFilter;
@ -2746,6 +2750,7 @@
} }
var var
classes = settings.oClasses,
tableId = settings.sTableId, tableId = settings.sTableId,
menu = settings.aLengthMenu, menu = settings.aLengthMenu,
d2 = $.isArray( menu[0] ), d2 = $.isArray( menu[0] ),
@ -2754,14 +2759,15 @@
var select = $('<select/>', { var select = $('<select/>', {
'name': tableId+'_length', 'name': tableId+'_length',
'aria-controls': tableId 'aria-controls': tableId,
'class': classes.sLengthSelect
} ); } );
for ( var i=0, ien=lengths.length ; i<ien ; i++ ) { for ( var i=0, ien=lengths.length ; i<ien ; i++ ) {
select[0][ i ] = new Option( language[i], lengths[i] ); select[0][ i ] = new Option( language[i], lengths[i] );
} }
var div = $('<div><label/></div>').addClass( settings.oClasses.sLength ); var div = $('<div><label/></div>').addClass( classes.sLength );
if ( ! settings.aanFeatures.l ) { if ( ! settings.aanFeatures.l ) {
div[0].id = tableId+'_length'; div[0].id = tableId+'_length';
} }
@ -13321,14 +13327,11 @@
"sSortableNone": "sorting_disabled", "sSortableNone": "sorting_disabled",
"sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */ "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */
// Deprecated /* Filtering */
"sSortJUIAsc": "", "sFilterInput": "",
"sSortJUIDesc": "",
"sSortJUI": "", /* Page length */
"sSortJUIAscAllowed": "", "sLengthSelect": "",
"sSortJUIDescAllowed": "",
"sSortJUIWrapper": "",
"sSortIcon": "",
/* Scrolling */ /* Scrolling */
"sScrollWrapper": "dataTables_scroll", "sScrollWrapper": "dataTables_scroll",
@ -13343,6 +13346,13 @@
"sFooterTH": "", "sFooterTH": "",
// Deprecated // Deprecated
"sSortJUIAsc": "",
"sSortJUIDesc": "",
"sSortJUI": "",
"sSortJUIAscAllowed": "",
"sSortJUIDescAllowed": "",
"sSortJUIWrapper": "",
"sSortIcon": "",
"sJUIHeader": "", "sJUIHeader": "",
"sJUIFooter": "" "sJUIFooter": ""
} ); } );