mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
New: Accessability features - the length changing control and filtering control are now wrapped in <label> tags (an explicit relationship to their input elements) to aid accessability. You can see this immediately by simply clicking on the "Search:" text now - it will focus the input of the text box, while for screen readers it will give the label text from the label.
New: The filtering input language string (oLanguage.sSearch) now has the "macro" _INPUT_ in it to allow the input element to be positioned anywhere in the string. For example if you gave "sSearch": "Data_INPUT_Tables" the output for the filter would be "Data<input.../>Tables". This is optional - if _INPUT_ is not given, then as before will will tack the input element on to the end of the given (or default) text string.
This commit is contained in:
parent
aaf9697bd6
commit
c14169903f
12
media/js/jquery.dataTables.js
vendored
12
media/js/jquery.dataTables.js
vendored
@ -4181,14 +4181,18 @@
|
||||
*/
|
||||
function _fnFeatureHtmlFilter ( oSettings )
|
||||
{
|
||||
var sSearchStr = oSettings.oLanguage.sSearch;
|
||||
sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?
|
||||
sSearchStr.replace('_INPUT_', '<input type="text" />') :
|
||||
sSearchStr==="" ? '<input type="text" />' : sSearchStr+' <input type="text" />';
|
||||
|
||||
var nFilter = document.createElement( 'div' );
|
||||
nFilter.className = oSettings.oClasses.sFilter;
|
||||
nFilter.innerHTML = '<label>'+sSearchStr+'</label>';
|
||||
if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.f == "undefined" )
|
||||
{
|
||||
nFilter.setAttribute( 'id', oSettings.sTableId+'_filter' );
|
||||
}
|
||||
nFilter.className = oSettings.oClasses.sFilter;
|
||||
var sSpace = oSettings.oLanguage.sSearch==="" ? "" : " ";
|
||||
nFilter.innerHTML = oSettings.oLanguage.sSearch+sSpace+'<input type="text" />';
|
||||
|
||||
var jqFilter = $("input", nFilter);
|
||||
jqFilter.val( oSettings.oPreviousSearch.sSearch.replace('"','"') );
|
||||
@ -5190,7 +5194,7 @@
|
||||
nLength.setAttribute( 'id', oSettings.sTableId+'_length' );
|
||||
}
|
||||
nLength.className = oSettings.oClasses.sLength;
|
||||
nLength.innerHTML = oSettings.oLanguage.sLengthMenu.replace( '_MENU_', sStdMenu );
|
||||
nLength.innerHTML = '<label>'+oSettings.oLanguage.sLengthMenu.replace( '_MENU_', sStdMenu )+'</label>';
|
||||
|
||||
/*
|
||||
* Set the length to the current display length - thanks to Andrea Pavlovic for this fix,
|
||||
|
Loading…
x
Reference in New Issue
Block a user