Strange whitespace issue
Strange whitespace issue
gretch
Posts: 4Questions: 0Answers: 0
For some reason when I turn smart filtering off, it won't find any whitespace.
If I search for "ben" it will find it in the table but if i search "ben bob" even when the whitespace is in that spot it won't find it. No idea what I'm doing wrong...
Here is all the javascript relating to the table.
// sorting by date
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-uk-pre": function ( a ) {
var ukDatea = a.split('/');
return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
},
"date-uk-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-uk-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
//sort without tags
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"num-html-pre": function ( a ) {
var x = a.replace( /<.*?>/g, "" );
return parseFloat( x );
},
"num-html-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"num-html-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
$(document).ready(function() {
var oTable = $('#test_table').dataTable( {
"sScrollY": "600px",
"bScrollCollapse": true,
"sScrollX": "1000px",
"bPaginate": false,
"bInfo": false,
"bScrollAutoCss": true,
"oLanguage": {
"sSearch": "Quick Search:"
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ -1 ] },
],
"fnInitComplete":function(){
$("#containing").show();
},
"fnDrawCallback": function( oSettings ) {
table_height = $("#test_table").height();
$("#view_heading").css("top", -1*(table_height+128));
}
} );
$('#entry1').keyup(function(){
oTable.fnFilter((this.value),7,true,false);
});
new FixedColumns( oTable, {
"iLeftColumns": 0,
"iRightColumns": 1,
"sHeightMatch": "auto"
} );
for(c = 0; c < col_dis_list.length; c++) {
if(col_dis_list[c] == 0) {
oTable.fnSetColumnVis(c, false);
}
}
} );
If I search for "ben" it will find it in the table but if i search "ben bob" even when the whitespace is in that spot it won't find it. No idea what I'm doing wrong...
Here is all the javascript relating to the table.
// sorting by date
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-uk-pre": function ( a ) {
var ukDatea = a.split('/');
return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
},
"date-uk-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-uk-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
//sort without tags
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"num-html-pre": function ( a ) {
var x = a.replace( /<.*?>/g, "" );
return parseFloat( x );
},
"num-html-asc": function ( a, b ) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"num-html-desc": function ( a, b ) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
$(document).ready(function() {
var oTable = $('#test_table').dataTable( {
"sScrollY": "600px",
"bScrollCollapse": true,
"sScrollX": "1000px",
"bPaginate": false,
"bInfo": false,
"bScrollAutoCss": true,
"oLanguage": {
"sSearch": "Quick Search:"
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ -1 ] },
],
"fnInitComplete":function(){
$("#containing").show();
},
"fnDrawCallback": function( oSettings ) {
table_height = $("#test_table").height();
$("#view_heading").css("top", -1*(table_height+128));
}
} );
$('#entry1').keyup(function(){
oTable.fnFilter((this.value),7,true,false);
});
new FixedColumns( oTable, {
"iLeftColumns": 0,
"iRightColumns": 1,
"sHeightMatch": "auto"
} );
for(c = 0; c < col_dis_list.length; c++) {
if(col_dis_list[c] == 0) {
oTable.fnSetColumnVis(c, false);
}
}
} );
This discussion has been closed.
Replies
I needed to search for non breaking spaces ( ) and forgot that regex whitespace doesn't include these.