mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Fix filtered child rows - issue #89
This commit is contained in:
parent
1423d37d1b
commit
8f020a5dba
@ -34,7 +34,9 @@
|
|||||||
// class name applied to filter row and each input
|
// class name applied to filter row and each input
|
||||||
filter_cssFilter : 'tablesorter-filter',
|
filter_cssFilter : 'tablesorter-filter',
|
||||||
// search from beginning
|
// search from beginning
|
||||||
filter_startsWith : false
|
filter_startsWith : false,
|
||||||
|
// Set this option to false to make the searches case sensitive
|
||||||
|
filter_ignoreCase : true
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -204,11 +204,11 @@ $.tablesorter.addWidget({
|
|||||||
l = $tr.length;
|
l = $tr.length;
|
||||||
// loop through the rows
|
// loop through the rows
|
||||||
for (j = 0; j < l; j++) {
|
for (j = 0; j < l; j++) {
|
||||||
// skip child rows
|
|
||||||
if (reg1.test($tr[j].className)) { continue; }
|
|
||||||
if (cv === '') {
|
if (cv === '') {
|
||||||
$tr[j].style.display = '';
|
$tr[j].style.display = '';
|
||||||
} else {
|
} else {
|
||||||
|
// skip child rows
|
||||||
|
if (reg1.test($tr[j].className)) { continue; }
|
||||||
r = true;
|
r = true;
|
||||||
cr = $tr.eq(j).nextUntil('tr:not(.' + c.cssChildRow + ')');
|
cr = $tr.eq(j).nextUntil('tr:not(.' + c.cssChildRow + ')');
|
||||||
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
|
// so, if "table.config.widgetOptions.filter_childRows" is true and there is
|
||||||
@ -216,6 +216,7 @@ $.tablesorter.addWidget({
|
|||||||
// checked here so the option can be changed dynamically
|
// checked here so the option can be changed dynamically
|
||||||
t = (cr.length && (wo && wo.hasOwnProperty('filter_childRows') &&
|
t = (cr.length && (wo && wo.hasOwnProperty('filter_childRows') &&
|
||||||
typeof wo.filter_childRows !== 'undefined' ? wo.filter_childRows : true)) ? cr.text() : '';
|
typeof wo.filter_childRows !== 'undefined' ? wo.filter_childRows : true)) ? cr.text() : '';
|
||||||
|
t = wo.filter_ignoreCase ? t.toLocaleLowerCase() : t;
|
||||||
$td = $tr.eq(j).children('td');
|
$td = $tr.eq(j).children('td');
|
||||||
for (i = 0; i < cols; i++) {
|
for (i = 0; i < cols; i++) {
|
||||||
x = $.trim($td.eq(i).text());
|
x = $.trim($td.eq(i).text());
|
||||||
@ -293,6 +294,7 @@ $.tablesorter.addWidget({
|
|||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
|
wo.filter_ignoreCase = wo.filter_ignoreCase !== false; // set default filter_ignoreCase to true
|
||||||
for (i=0; i < cols; i++){
|
for (i=0; i < cols; i++){
|
||||||
$th = $ths.filter('[data-column="' + i + '"]:last'); // assuming last cell of a column is the main column
|
$th = $ths.filter('[data-column="' + i + '"]:last'); // assuming last cell of a column is the main column
|
||||||
sel = (wo.filter_functions && wo.filter_functions[i] && typeof wo.filter_functions[i] !== 'function') || $th.hasClass('filter-select');
|
sel = (wo.filter_functions && wo.filter_functions[i] && typeof wo.filter_functions[i] !== 'function') || $th.hasClass('filter-select');
|
||||||
|
Loading…
Reference in New Issue
Block a user