mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-30 23:52:11 +01:00
Dev update: Slight modification of style for the inner functions in the pagination controls
This commit is contained in:
parent
841480fa59
commit
1ae7f81a11
@ -12,9 +12,49 @@
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="../../media/js/jquery.dataTables.js"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable();
|
||||
jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay ) {
|
||||
/*
|
||||
* Inputs: object:oSettings - dataTables settings object - automatically given
|
||||
* integer:iDelay - delay in milliseconds
|
||||
* Usage: $('#example').dataTable().fnSetFilteringDelay(250);
|
||||
* Author: Zygimantas Berziunas (www.zygimantas.com) and Allan Jardine
|
||||
* License: GPL v2 or BSD 3 point style
|
||||
* Contact: zygimantas.berziunas /AT\ hotmail.com
|
||||
*/
|
||||
var
|
||||
_that = this,
|
||||
iDelay = (typeof iDelay == 'undefined') ? 250 : iDelay;
|
||||
|
||||
this.each( function ( i ) {
|
||||
$.fn.dataTableExt.iApiIndex = i;
|
||||
var
|
||||
$this = this,
|
||||
oTimerId = null,
|
||||
sPreviousSearch = null,
|
||||
anControl = $( 'input', _that.fnSettings().aanFeatures.f );
|
||||
|
||||
anControl.unbind( 'keyup' ).bind( 'keyup', function() {
|
||||
var $$this = $this;
|
||||
|
||||
if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
|
||||
window.clearTimeout(oTimerId);
|
||||
sPreviousSearch = anControl.val();
|
||||
oTimerId = window.setTimeout(function() {
|
||||
$.fn.dataTableExt.iApiIndex = i;
|
||||
_that.fnFilter( anControl.val() );
|
||||
}, iDelay);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
} );
|
||||
return this;
|
||||
}
|
||||
|
||||
/* Example call */
|
||||
$(document).ready(function() {
|
||||
$('#example').dataTable().fnSetFilteringDelay();
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body id="dt_example">
|
||||
|
22
media/js/jquery.dataTables.js
vendored
22
media/js/jquery.dataTables.js
vendored
@ -286,14 +286,13 @@
|
||||
*/
|
||||
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
|
||||
{
|
||||
function fnClickHandler ( e ) {
|
||||
var nPrevious, nNext, nPreviousInner, nNextInner;
|
||||
var fnClickHandler = function ( e ) {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
}
|
||||
|
||||
var nPrevious, nNext, nPreviousInner, nNextInner;
|
||||
};
|
||||
|
||||
/* Store the next and previous elements in the oSettings object as they can be very
|
||||
* usful for automation - particularly testing
|
||||
@ -331,7 +330,7 @@
|
||||
.bind( 'selectstart.DT', function () { return false; } ); /* Take the brutal approach to cancelling text selection */
|
||||
$(nNext)
|
||||
.bind( 'click.DT', { action: "next" }, fnClickHandler )
|
||||
.bind( 'selectstart.DT', function () { return false; } ); /* Take the brutal approach to cancelling text selection */
|
||||
.bind( 'selectstart.DT', function () { return false; } );
|
||||
|
||||
/* ID the first elements only */
|
||||
if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.p == "undefined" )
|
||||
@ -398,18 +397,17 @@
|
||||
*/
|
||||
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
|
||||
{
|
||||
function fnClickHandler ( e ) {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
}
|
||||
|
||||
var nFirst = document.createElement( 'span' );
|
||||
var nPrevious = document.createElement( 'span' );
|
||||
var nList = document.createElement( 'span' );
|
||||
var nNext = document.createElement( 'span' );
|
||||
var nLast = document.createElement( 'span' );
|
||||
var fnClickHandler = function ( e ) {
|
||||
if ( oSettings.oApi._fnPageChange( oSettings, e.data.action ) )
|
||||
{
|
||||
fnCallbackDraw( oSettings );
|
||||
}
|
||||
};
|
||||
|
||||
nFirst.innerHTML = oSettings.oLanguage.oPaginate.sFirst;
|
||||
nPrevious.innerHTML = oSettings.oLanguage.oPaginate.sPrevious;
|
||||
|
Loading…
x
Reference in New Issue
Block a user