White spaces issue in the column filter

White spaces issue in the column filter

NamrataNamrata Posts: 6Questions: 0Answers: 0
edited June 2013 in DataTables 1.8
Hi Everybody,

I have used column filter for each column. I have got one issue in this,

If I searched for 'a' and put some white space after 'a ', then is not filtering properly. It should show the message 'No matching records found'.

Can anyone help me in this?

My code is,

oTable = $('#gridContent').dataTable({

"bJQueryUI": true,
"iDisplayLength": 25,
"oLanguage": {
"sSearch": "Search all columns:",
"sInfo": "_TOTAL_ item(s) found, displaying (_START_ to _END_)",
//"sInfoFiltered": "", // To avoid getting filtered info
//"sLengthMenu": "Show _MENU_ items per page",
"sLengthMenu": 'Show '+
'25'+
'50'+
'100'+
' items per page',
"oPaginate": {
"sFirst": "<<",
"sLast": ">>",
"sNext": ">",
"sPrevious": "<"
}
},

//"sScrollX": "100%",
"sDom": 'R<"top"lpi>rt<"bottom"lpi><"clear">', // Placing of Info, Search, Pagination
//"sDom": 'zR<"top"<"data_info"l><"data_page"ip>>rt<"bottom"<"data_page"ip>><"clear">',// Placing of Info, Search,
"bAutoWidth": false,
"aoColumns": [
{"sTitle": "Site name","sClass": "siteNameClass wrapTxt", "bSortable": true},
{"sTitle": "Site code", "sClass": "siteCodeClass wrapTxt", "bSortable": false},
{"sTitle": "Address", "sClass": "siteAddClass wrapTxt", "bSortable": false},
{"sTitle": "City", "sClass": "siteCityClass wrapTxt", "bSortable": false},
{"sTitle": "Post code","sClass": "sitePostClass wrapTxt", "bSortable": false}

], // Column names
"sPaginationType": "full_numbers",
"bProcessing": "", // Enable or disable the display of a 'processing' indicator when the table is being processed
"sAjaxSource": 'ajax/arrays.json',

"bRetrieve": true,

//function for link from datatable row

"bDestroy":true
});
// datatable closed
}


//script for Footer
var asInitVals = new Array();

$(document).ready(function() {

$(".linkname").live("click", function() {
var id = $(this).attr("id");
var title = $(this).attr("title");
$("#sideDiv").hide();
$("#siteDetailsdiv").show();
$("#siteList_BreadCrumbs").hide();
$("#siteDetails_BreadCrumbs").show();
loadSiteDetails( id, title );
return false;
});

$("tfoot input").keyup( function () {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("tfoot input").index(this) );
} );

/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("tfoot input").each( function (i) {
asInitVals[i] = this.value;
} );

$("tfoot input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );

$("tfoot input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("tfoot input").index(this)];
}
} );
This discussion has been closed.