Filter: prevent undefined error. Fixes #819

This commit is contained in:
Mottie 2015-02-12 10:13:22 -06:00
parent e7bbf5d5a7
commit 15284156d8
2 changed files with 7 additions and 21 deletions

View File

@ -1260,11 +1260,12 @@ ts.filter = {
data.anyMatch = true; data.anyMatch = true;
data.rowArray = $cells.map(function(i){ data.rowArray = $cells.map(function(i){
if ( $.inArray(i, columnIndex) > -1 ) { if ( $.inArray(i, columnIndex) > -1 ) {
var txt; var txt, $this;
if (data.parsed[i]) { if (data.parsed[i]) {
txt = data.cacheArray[i]; txt = data.cacheArray[i];
} else { } else {
txt = this.getAttribute( c.textAttribute ) || this.textContent || $(this).text(); $this = $(this);
txt = $this.length ? $this.attr( c.textAttribute ) || this.textContent || $this.text() : '';
txt = $.trim( wo.filter_ignoreCase ? txt.toLowerCase() : txt ); txt = $.trim( wo.filter_ignoreCase ? txt.toLowerCase() : txt );
if (c.sortLocaleCompare) { if (c.sortLocaleCompare) {
txt = ts.replaceAccents(txt); txt = ts.replaceAccents(txt);
@ -1319,8 +1320,8 @@ ts.filter = {
if (wo.filter_useParsedData || data.parsed[columnIndex]) { if (wo.filter_useParsedData || data.parsed[columnIndex]) {
data.exact = data.cache; data.exact = data.cache;
} else { } else {
val = $cells[columnIndex]; val = $cells.eq(columnIndex);
result = $.trim( val.getAttribute( c.textAttribute ) || val.textContent || $cells.eq(columnIndex).text() ); result = val.length ? $.trim( val.attr( c.textAttribute ) || val[0].textContent || val.text() ) : '';
data.exact = c.sortLocaleCompare ? ts.replaceAccents(result) : result; // issue #405 data.exact = c.sortLocaleCompare ? ts.replaceAccents(result) : result; // issue #405
} }
data.iExact = !regex.type.test(typeof data.exact) && wo.filter_ignoreCase ? data.exact.toLocaleLowerCase() : data.exact; data.iExact = !regex.type.test(typeof data.exact) && wo.filter_ignoreCase ? data.exact.toLocaleLowerCase() : data.exact;
@ -1506,7 +1507,7 @@ ts.filter = {
} else { } else {
cell = row.cells[column]; cell = row.cells[column];
if (cell) { if (cell) {
arry.push( $.trim( cell.getAttribute( c.textAttribute ) || cell.textContent || $(cell).text() ) ); arry.push( $.trim( $(cell).attr( c.textAttribute ) || cell.textContent || $(cell).text() ) );
} }
} }
} }

File diff suppressed because one or more lines are too long