mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-10-08 13:44:18 +00:00
Filter: cache main loop variables
This commit is contained in:
parent
c2c4f8d8a0
commit
cd98f306bb
27
dist/js/jquery.tablesorter.combined.js
vendored
27
dist/js/jquery.tablesorter.combined.js
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! tablesorter (FORK) - updated 04-02-2015 (v2.21.4)*/
|
/*! tablesorter (FORK) - updated 04-07-2015 (v2.21.4)*/
|
||||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -3297,6 +3297,19 @@ ts.filter = {
|
|||||||
$(this).hasClass('filter-parsed');
|
$(this).hasClass('filter-parsed');
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
// cache filter variables that use ts.getColumnData in the main loop
|
||||||
|
wo.filter_indexed = {
|
||||||
|
functions : [],
|
||||||
|
excludeFilter : [],
|
||||||
|
defaultColFilter : [],
|
||||||
|
defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
|
||||||
|
};
|
||||||
|
for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
|
||||||
|
wo.filter_indexed.functions[ columnIndex ] = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
||||||
|
wo.filter_indexed.defaultColFilter[ columnIndex ] = ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
|
||||||
|
wo.filter_indexed.excludeFilter[ columnIndex ] = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
||||||
|
}
|
||||||
|
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
ts.log('Filter: Starting filter widget search', filters);
|
ts.log('Filter: Starting filter widget search', filters);
|
||||||
time = new Date();
|
time = new Date();
|
||||||
@ -3383,8 +3396,8 @@ ts.filter = {
|
|||||||
// replace accents
|
// replace accents
|
||||||
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
||||||
}
|
}
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
|
if ( wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultAnyFilter ) ) {
|
||||||
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
|
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, wo.filter_indexed.defaultAnyFilter );
|
||||||
// clear search filtered flag because default filters are not saved to the last search
|
// clear search filtered flag because default filters are not saved to the last search
|
||||||
searchFiltered = false;
|
searchFiltered = false;
|
||||||
}
|
}
|
||||||
@ -3466,7 +3479,7 @@ ts.filter = {
|
|||||||
data.index = columnIndex;
|
data.index = columnIndex;
|
||||||
|
|
||||||
// filter types to exclude, per column
|
// filter types to exclude, per column
|
||||||
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
excludeMatch = wo.filter_indexed.excludeFilter[ columnIndex ];
|
||||||
|
|
||||||
// ignore if filter is empty or disabled
|
// ignore if filter is empty or disabled
|
||||||
if (data.filter) {
|
if (data.filter) {
|
||||||
@ -3491,14 +3504,14 @@ ts.filter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = true;
|
val = true;
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
|
if (wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultColFilter[ columnIndex ] )) {
|
||||||
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
|
data.filter = ts.filter.defaultFilter( data.filter, wo.filter_indexed.defaultColFilter[ columnIndex ] );
|
||||||
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
||||||
val = false;
|
val = false;
|
||||||
}
|
}
|
||||||
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
||||||
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
||||||
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
fxn = wo.filter_indexed.functions[ columnIndex ];
|
||||||
$cell = c.$headerIndexed[columnIndex];
|
$cell = c.$headerIndexed[columnIndex];
|
||||||
hasSelect = $cell.hasClass('filter-select');
|
hasSelect = $cell.hasClass('filter-select');
|
||||||
if ( fxn || ( hasSelect && val ) ) {
|
if ( fxn || ( hasSelect && val ) ) {
|
||||||
|
6
dist/js/jquery.tablesorter.combined.min.js
vendored
6
dist/js/jquery.tablesorter.combined.min.js
vendored
File diff suppressed because one or more lines are too long
27
dist/js/jquery.tablesorter.widgets.js
vendored
27
dist/js/jquery.tablesorter.widgets.js
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! tablesorter (FORK) - updated 04-02-2015 (v2.21.4)*/
|
/*! tablesorter (FORK) - updated 04-07-2015 (v2.21.4)*/
|
||||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -1168,6 +1168,19 @@ ts.filter = {
|
|||||||
$(this).hasClass('filter-parsed');
|
$(this).hasClass('filter-parsed');
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
// cache filter variables that use ts.getColumnData in the main loop
|
||||||
|
wo.filter_indexed = {
|
||||||
|
functions : [],
|
||||||
|
excludeFilter : [],
|
||||||
|
defaultColFilter : [],
|
||||||
|
defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
|
||||||
|
};
|
||||||
|
for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
|
||||||
|
wo.filter_indexed.functions[ columnIndex ] = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
||||||
|
wo.filter_indexed.defaultColFilter[ columnIndex ] = ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
|
||||||
|
wo.filter_indexed.excludeFilter[ columnIndex ] = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
||||||
|
}
|
||||||
|
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
ts.log('Filter: Starting filter widget search', filters);
|
ts.log('Filter: Starting filter widget search', filters);
|
||||||
time = new Date();
|
time = new Date();
|
||||||
@ -1254,8 +1267,8 @@ ts.filter = {
|
|||||||
// replace accents
|
// replace accents
|
||||||
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
||||||
}
|
}
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
|
if ( wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultAnyFilter ) ) {
|
||||||
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
|
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, wo.filter_indexed.defaultAnyFilter );
|
||||||
// clear search filtered flag because default filters are not saved to the last search
|
// clear search filtered flag because default filters are not saved to the last search
|
||||||
searchFiltered = false;
|
searchFiltered = false;
|
||||||
}
|
}
|
||||||
@ -1337,7 +1350,7 @@ ts.filter = {
|
|||||||
data.index = columnIndex;
|
data.index = columnIndex;
|
||||||
|
|
||||||
// filter types to exclude, per column
|
// filter types to exclude, per column
|
||||||
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
excludeMatch = wo.filter_indexed.excludeFilter[ columnIndex ];
|
||||||
|
|
||||||
// ignore if filter is empty or disabled
|
// ignore if filter is empty or disabled
|
||||||
if (data.filter) {
|
if (data.filter) {
|
||||||
@ -1362,14 +1375,14 @@ ts.filter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = true;
|
val = true;
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
|
if (wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultColFilter[ columnIndex ] )) {
|
||||||
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
|
data.filter = ts.filter.defaultFilter( data.filter, wo.filter_indexed.defaultColFilter[ columnIndex ] );
|
||||||
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
||||||
val = false;
|
val = false;
|
||||||
}
|
}
|
||||||
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
||||||
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
||||||
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
fxn = wo.filter_indexed.functions[ columnIndex ];
|
||||||
$cell = c.$headerIndexed[columnIndex];
|
$cell = c.$headerIndexed[columnIndex];
|
||||||
hasSelect = $cell.hasClass('filter-select');
|
hasSelect = $cell.hasClass('filter-select');
|
||||||
if ( fxn || ( hasSelect && val ) ) {
|
if ( fxn || ( hasSelect && val ) ) {
|
||||||
|
6
dist/js/jquery.tablesorter.widgets.min.js
vendored
6
dist/js/jquery.tablesorter.widgets.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-filter.min.js
vendored
2
dist/js/widgets/widget-filter.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
||||||
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
||||||
*/
|
*/
|
||||||
/*! tablesorter (FORK) - updated 04-02-2015 (v2.21.4)*/
|
/*! tablesorter (FORK) - updated 04-07-2015 (v2.21.4)*/
|
||||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -3303,6 +3303,19 @@ ts.filter = {
|
|||||||
$(this).hasClass('filter-parsed');
|
$(this).hasClass('filter-parsed');
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
// cache filter variables that use ts.getColumnData in the main loop
|
||||||
|
wo.filter_indexed = {
|
||||||
|
functions : [],
|
||||||
|
excludeFilter : [],
|
||||||
|
defaultColFilter : [],
|
||||||
|
defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
|
||||||
|
};
|
||||||
|
for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
|
||||||
|
wo.filter_indexed.functions[ columnIndex ] = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
||||||
|
wo.filter_indexed.defaultColFilter[ columnIndex ] = ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
|
||||||
|
wo.filter_indexed.excludeFilter[ columnIndex ] = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
||||||
|
}
|
||||||
|
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
ts.log('Filter: Starting filter widget search', filters);
|
ts.log('Filter: Starting filter widget search', filters);
|
||||||
time = new Date();
|
time = new Date();
|
||||||
@ -3389,8 +3402,8 @@ ts.filter = {
|
|||||||
// replace accents
|
// replace accents
|
||||||
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
||||||
}
|
}
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
|
if ( wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultAnyFilter ) ) {
|
||||||
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
|
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, wo.filter_indexed.defaultAnyFilter );
|
||||||
// clear search filtered flag because default filters are not saved to the last search
|
// clear search filtered flag because default filters are not saved to the last search
|
||||||
searchFiltered = false;
|
searchFiltered = false;
|
||||||
}
|
}
|
||||||
@ -3472,7 +3485,7 @@ ts.filter = {
|
|||||||
data.index = columnIndex;
|
data.index = columnIndex;
|
||||||
|
|
||||||
// filter types to exclude, per column
|
// filter types to exclude, per column
|
||||||
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
excludeMatch = wo.filter_indexed.excludeFilter[ columnIndex ];
|
||||||
|
|
||||||
// ignore if filter is empty or disabled
|
// ignore if filter is empty or disabled
|
||||||
if (data.filter) {
|
if (data.filter) {
|
||||||
@ -3497,14 +3510,14 @@ ts.filter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = true;
|
val = true;
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
|
if (wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultColFilter[ columnIndex ] )) {
|
||||||
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
|
data.filter = ts.filter.defaultFilter( data.filter, wo.filter_indexed.defaultColFilter[ columnIndex ] );
|
||||||
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
||||||
val = false;
|
val = false;
|
||||||
}
|
}
|
||||||
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
||||||
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
||||||
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
fxn = wo.filter_indexed.functions[ columnIndex ];
|
||||||
$cell = c.$headerIndexed[columnIndex];
|
$cell = c.$headerIndexed[columnIndex];
|
||||||
hasSelect = $cell.hasClass('filter-select');
|
hasSelect = $cell.hasClass('filter-select');
|
||||||
if ( fxn || ( hasSelect && val ) ) {
|
if ( fxn || ( hasSelect && val ) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
||||||
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
||||||
*/
|
*/
|
||||||
/*! tablesorter (FORK) - updated 04-02-2015 (v2.21.4)*/
|
/*! tablesorter (FORK) - updated 04-07-2015 (v2.21.4)*/
|
||||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -1174,6 +1174,19 @@ ts.filter = {
|
|||||||
$(this).hasClass('filter-parsed');
|
$(this).hasClass('filter-parsed');
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
// cache filter variables that use ts.getColumnData in the main loop
|
||||||
|
wo.filter_indexed = {
|
||||||
|
functions : [],
|
||||||
|
excludeFilter : [],
|
||||||
|
defaultColFilter : [],
|
||||||
|
defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
|
||||||
|
};
|
||||||
|
for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
|
||||||
|
wo.filter_indexed.functions[ columnIndex ] = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
||||||
|
wo.filter_indexed.defaultColFilter[ columnIndex ] = ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
|
||||||
|
wo.filter_indexed.excludeFilter[ columnIndex ] = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
||||||
|
}
|
||||||
|
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
ts.log('Filter: Starting filter widget search', filters);
|
ts.log('Filter: Starting filter widget search', filters);
|
||||||
time = new Date();
|
time = new Date();
|
||||||
@ -1260,8 +1273,8 @@ ts.filter = {
|
|||||||
// replace accents
|
// replace accents
|
||||||
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
||||||
}
|
}
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
|
if ( wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultAnyFilter ) ) {
|
||||||
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
|
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, wo.filter_indexed.defaultAnyFilter );
|
||||||
// clear search filtered flag because default filters are not saved to the last search
|
// clear search filtered flag because default filters are not saved to the last search
|
||||||
searchFiltered = false;
|
searchFiltered = false;
|
||||||
}
|
}
|
||||||
@ -1343,7 +1356,7 @@ ts.filter = {
|
|||||||
data.index = columnIndex;
|
data.index = columnIndex;
|
||||||
|
|
||||||
// filter types to exclude, per column
|
// filter types to exclude, per column
|
||||||
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
excludeMatch = wo.filter_indexed.excludeFilter[ columnIndex ];
|
||||||
|
|
||||||
// ignore if filter is empty or disabled
|
// ignore if filter is empty or disabled
|
||||||
if (data.filter) {
|
if (data.filter) {
|
||||||
@ -1368,14 +1381,14 @@ ts.filter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = true;
|
val = true;
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
|
if (wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultColFilter[ columnIndex ] )) {
|
||||||
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
|
data.filter = ts.filter.defaultFilter( data.filter, wo.filter_indexed.defaultColFilter[ columnIndex ] );
|
||||||
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
||||||
val = false;
|
val = false;
|
||||||
}
|
}
|
||||||
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
||||||
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
||||||
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
fxn = wo.filter_indexed.functions[ columnIndex ];
|
||||||
$cell = c.$headerIndexed[columnIndex];
|
$cell = c.$headerIndexed[columnIndex];
|
||||||
hasSelect = $cell.hasClass('filter-select');
|
hasSelect = $cell.hasClass('filter-select');
|
||||||
if ( fxn || ( hasSelect && val ) ) {
|
if ( fxn || ( hasSelect && val ) ) {
|
||||||
|
@ -801,6 +801,19 @@ ts.filter = {
|
|||||||
$(this).hasClass('filter-parsed');
|
$(this).hasClass('filter-parsed');
|
||||||
}).get();
|
}).get();
|
||||||
|
|
||||||
|
// cache filter variables that use ts.getColumnData in the main loop
|
||||||
|
wo.filter_indexed = {
|
||||||
|
functions : [],
|
||||||
|
excludeFilter : [],
|
||||||
|
defaultColFilter : [],
|
||||||
|
defaultAnyFilter : ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || ''
|
||||||
|
};
|
||||||
|
for ( columnIndex = 0; columnIndex < c.columns; columnIndex++ ) {
|
||||||
|
wo.filter_indexed.functions[ columnIndex ] = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
||||||
|
wo.filter_indexed.defaultColFilter[ columnIndex ] = ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '';
|
||||||
|
wo.filter_indexed.excludeFilter[ columnIndex ] = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
||||||
|
}
|
||||||
|
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
ts.log('Filter: Starting filter widget search', filters);
|
ts.log('Filter: Starting filter widget search', filters);
|
||||||
time = new Date();
|
time = new Date();
|
||||||
@ -887,8 +900,8 @@ ts.filter = {
|
|||||||
// replace accents
|
// replace accents
|
||||||
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
data.anyMatchFilter = ts.replaceAccents(data.anyMatchFilter);
|
||||||
}
|
}
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) || '')) {
|
if ( wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultAnyFilter ) ) {
|
||||||
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, ts.getColumnData( table, wo.filter_defaultFilter, c.columns, true ) );
|
data.anyMatchFilter = ts.filter.defaultFilter( data.anyMatchFilter, wo.filter_indexed.defaultAnyFilter );
|
||||||
// clear search filtered flag because default filters are not saved to the last search
|
// clear search filtered flag because default filters are not saved to the last search
|
||||||
searchFiltered = false;
|
searchFiltered = false;
|
||||||
}
|
}
|
||||||
@ -970,7 +983,7 @@ ts.filter = {
|
|||||||
data.index = columnIndex;
|
data.index = columnIndex;
|
||||||
|
|
||||||
// filter types to exclude, per column
|
// filter types to exclude, per column
|
||||||
excludeMatch = ( ts.getColumnData( table, wo.filter_excludeFilter, columnIndex, true ) || '' ).split(/\s+/);
|
excludeMatch = wo.filter_indexed.excludeFilter[ columnIndex ];
|
||||||
|
|
||||||
// ignore if filter is empty or disabled
|
// ignore if filter is empty or disabled
|
||||||
if (data.filter) {
|
if (data.filter) {
|
||||||
@ -995,14 +1008,14 @@ ts.filter = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val = true;
|
val = true;
|
||||||
if (wo.filter_defaultFilter && regex.iQuery.test( ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) || '')) {
|
if (wo.filter_defaultFilter && regex.iQuery.test( wo.filter_indexed.defaultColFilter[ columnIndex ] )) {
|
||||||
data.filter = ts.filter.defaultFilter( data.filter, ts.getColumnData( table, wo.filter_defaultFilter, columnIndex ) );
|
data.filter = ts.filter.defaultFilter( data.filter, wo.filter_indexed.defaultColFilter[ columnIndex ] );
|
||||||
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
// val is used to indicate that a filter select is using a default filter; so we override the exact & partial matches
|
||||||
val = false;
|
val = false;
|
||||||
}
|
}
|
||||||
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
// data.iFilter = case insensitive (if wo.filter_ignoreCase is true), data.filter = case sensitive
|
||||||
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
data.iFilter = wo.filter_ignoreCase ? (data.filter || '').toLocaleLowerCase() : data.filter;
|
||||||
fxn = ts.getColumnData( table, wo.filter_functions, columnIndex );
|
fxn = wo.filter_indexed.functions[ columnIndex ];
|
||||||
$cell = c.$headerIndexed[columnIndex];
|
$cell = c.$headerIndexed[columnIndex];
|
||||||
hasSelect = $cell.hasClass('filter-select');
|
hasSelect = $cell.hasClass('filter-select');
|
||||||
if ( fxn || ( hasSelect && val ) ) {
|
if ( fxn || ( hasSelect && val ) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user