cc-2381: slow library searching speed
-implemented 350ms keystroke delay before searching
This commit is contained in:
parent
35cbeffd4a
commit
b802ba9a42
3 changed files with 42 additions and 1 deletions
|
@ -28,6 +28,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
|
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
||||||
|
|
||||||
|
|
|
@ -175,5 +175,5 @@ $(document).ready(function() {
|
||||||
"oLanguage": {
|
"oLanguage": {
|
||||||
"sSearch": ""
|
"sSearch": ""
|
||||||
}
|
}
|
||||||
});
|
}).fnSetFilteringDelay(350);
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
alert("hi");
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue