How to disable search for one column of a table

How to disable search for one column of a table

amitpramitpr Posts: 1Questions: 0Answers: 0
edited November 2013 in General
I have one table in which my first column contains radio button and last column contains a href link.
I have used below code to highlight the search text:

$(document).ready(function() {
$('#tableAllScripts').dataTable( {
"iDisplayLength": 10000,
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var settings = this.fnSettings();
var str = settings.oPreviousSearch.sSearch;
$('td', nRow).each( function (i) {
this.innerHTML = aData[i].replace( new RegExp( str, 'i'), function(matched) { return ""+matched+"";} );
} );
return nRow;
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] },
{ "bSearchable": false, "aTargets": [ 0 ] }
],
} );

} );

however when i search through input it shows html element code in the table. To avoid this situation i want to disable search on first and last column.
It would be great if someone can help me out with a solution. Thanks in advance

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited November 2013
    Use the bSearchable option.
    *edit* I see that you are. If that isn't working, please link to a test case showing the error so we can debug and resolve it.

    Allan
This discussion has been closed.