mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
Fix: Modify the filtering such that client-side filtering is not done when server-side processing is enabled - its just a waste of time since hte server will do it all - 7825
This commit is contained in:
parent
3f9b7430f1
commit
74f3426284
51
media/js/jquery.dataTables.js
vendored
51
media/js/jquery.dataTables.js
vendored
@ -2029,21 +2029,39 @@
|
||||
*/
|
||||
function _fnFilterComplete ( oSettings, oInput, iForce )
|
||||
{
|
||||
/* Filter on everything */
|
||||
_fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
|
||||
|
||||
/* Now do the individual column filter */
|
||||
for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||
var oPrevSearch = oSettings.oPreviousSearch;
|
||||
var aoPrevSearch = oSettings.aoPreSearchCols;
|
||||
var fnSaveFilter = function ( oFilter ) {
|
||||
/* Save the filtering values */
|
||||
oPrevSearch.sSearch = oFilter.sSearch;
|
||||
oPrevSearch.bRegex = oFilter.bRegex;
|
||||
oPrevSearch.bSmart = oFilter.bSmart;
|
||||
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
|
||||
};
|
||||
|
||||
/* In server-side processing all filtering is done by the server, so no point hanging around here */
|
||||
if ( !oSettings.oFeatures.bServerSide )
|
||||
{
|
||||
_fnFilterColumn( oSettings, oSettings.aoPreSearchCols[i].sSearch, i,
|
||||
oSettings.aoPreSearchCols[i].bRegex, oSettings.aoPreSearchCols[i].bSmart,
|
||||
oSettings.aoPreSearchCols[i].bCaseInsensitive );
|
||||
/* Global filter */
|
||||
_fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
|
||||
fnSaveFilter( oInput );
|
||||
|
||||
/* Now do the individual column filter */
|
||||
for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||
{
|
||||
_fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
|
||||
aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );
|
||||
}
|
||||
|
||||
/* Custom filtering */
|
||||
if ( DataTable.ext.afnFiltering.length !== 0 )
|
||||
{
|
||||
_fnFilterCustom( oSettings );
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom filtering */
|
||||
if ( DataTable.ext.afnFiltering.length !== 0 )
|
||||
else
|
||||
{
|
||||
_fnFilterCustom( oSettings );
|
||||
fnSaveFilter( oInput );
|
||||
}
|
||||
|
||||
/* Tell the draw function we have been filtering */
|
||||
@ -2133,6 +2151,7 @@
|
||||
{
|
||||
var i;
|
||||
var rpSearch = _fnFilterCreateSearch( sInput, bRegex, bSmart, bCaseInsensitive );
|
||||
var oPrevSearch = oSettings.oPreviousSearch;
|
||||
|
||||
/* Check if we are forcing or not - optional parameter */
|
||||
if ( !iForce )
|
||||
@ -2161,8 +2180,8 @@
|
||||
* then the old one (i.e. delete). Search from the master array
|
||||
*/
|
||||
if ( oSettings.aiDisplay.length == oSettings.aiDisplayMaster.length ||
|
||||
oSettings.oPreviousSearch.sSearch.length > sInput.length || iForce == 1 ||
|
||||
sInput.indexOf(oSettings.oPreviousSearch.sSearch) !== 0 )
|
||||
oPrevSearch.sSearch.length > sInput.length || iForce == 1 ||
|
||||
sInput.indexOf(oPrevSearch.sSearch) !== 0 )
|
||||
{
|
||||
/* Nuke the old display array - we are going to rebuild it */
|
||||
oSettings.aiDisplay.splice( 0, oSettings.aiDisplay.length);
|
||||
@ -2200,10 +2219,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
oSettings.oPreviousSearch.sSearch = sInput;
|
||||
oSettings.oPreviousSearch.bRegex = bRegex;
|
||||
oSettings.oPreviousSearch.bSmart = bSmart;
|
||||
oSettings.oPreviousSearch.bCaseInsensitive = bCaseInsensitive;
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,21 +70,39 @@ function _fnFeatureHtmlFilter ( oSettings )
|
||||
*/
|
||||
function _fnFilterComplete ( oSettings, oInput, iForce )
|
||||
{
|
||||
/* Filter on everything */
|
||||
_fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
|
||||
|
||||
/* Now do the individual column filter */
|
||||
for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||
var oPrevSearch = oSettings.oPreviousSearch;
|
||||
var aoPrevSearch = oSettings.aoPreSearchCols;
|
||||
var fnSaveFilter = function ( oFilter ) {
|
||||
/* Save the filtering values */
|
||||
oPrevSearch.sSearch = oFilter.sSearch;
|
||||
oPrevSearch.bRegex = oFilter.bRegex;
|
||||
oPrevSearch.bSmart = oFilter.bSmart;
|
||||
oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;
|
||||
};
|
||||
|
||||
/* In server-side processing all filtering is done by the server, so no point hanging around here */
|
||||
if ( !oSettings.oFeatures.bServerSide )
|
||||
{
|
||||
_fnFilterColumn( oSettings, oSettings.aoPreSearchCols[i].sSearch, i,
|
||||
oSettings.aoPreSearchCols[i].bRegex, oSettings.aoPreSearchCols[i].bSmart,
|
||||
oSettings.aoPreSearchCols[i].bCaseInsensitive );
|
||||
/* Global filter */
|
||||
_fnFilter( oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive );
|
||||
fnSaveFilter( oInput );
|
||||
|
||||
/* Now do the individual column filter */
|
||||
for ( var i=0 ; i<oSettings.aoPreSearchCols.length ; i++ )
|
||||
{
|
||||
_fnFilterColumn( oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,
|
||||
aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive );
|
||||
}
|
||||
|
||||
/* Custom filtering */
|
||||
if ( DataTable.ext.afnFiltering.length !== 0 )
|
||||
{
|
||||
_fnFilterCustom( oSettings );
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom filtering */
|
||||
if ( DataTable.ext.afnFiltering.length !== 0 )
|
||||
else
|
||||
{
|
||||
_fnFilterCustom( oSettings );
|
||||
fnSaveFilter( oInput );
|
||||
}
|
||||
|
||||
/* Tell the draw function we have been filtering */
|
||||
@ -174,6 +192,7 @@ function _fnFilter( oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive
|
||||
{
|
||||
var i;
|
||||
var rpSearch = _fnFilterCreateSearch( sInput, bRegex, bSmart, bCaseInsensitive );
|
||||
var oPrevSearch = oSettings.oPreviousSearch;
|
||||
|
||||
/* Check if we are forcing or not - optional parameter */
|
||||
if ( !iForce )
|
||||
@ -202,8 +221,8 @@ function _fnFilter( oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive
|
||||
* then the old one (i.e. delete). Search from the master array
|
||||
*/
|
||||
if ( oSettings.aiDisplay.length == oSettings.aiDisplayMaster.length ||
|
||||
oSettings.oPreviousSearch.sSearch.length > sInput.length || iForce == 1 ||
|
||||
sInput.indexOf(oSettings.oPreviousSearch.sSearch) !== 0 )
|
||||
oPrevSearch.sSearch.length > sInput.length || iForce == 1 ||
|
||||
sInput.indexOf(oPrevSearch.sSearch) !== 0 )
|
||||
{
|
||||
/* Nuke the old display array - we are going to rebuild it */
|
||||
oSettings.aiDisplay.splice( 0, oSettings.aiDisplay.length);
|
||||
@ -241,10 +260,6 @@ function _fnFilter( oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive
|
||||
}
|
||||
}
|
||||
}
|
||||
oSettings.oPreviousSearch.sSearch = sInput;
|
||||
oSettings.oPreviousSearch.bRegex = bRegex;
|
||||
oSettings.oPreviousSearch.bSmart = bSmart;
|
||||
oSettings.oPreviousSearch.bCaseInsensitive = bCaseInsensitive;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user