Individual column search boxes confilcting with colvis
Individual column search boxes confilcting with colvis
karam
Posts: 31Questions: 14Answers: 0
I have more than 70 columns and I am using ajax to load data so instead to writing <th> for all I use a for loop but when iam making columns invisible by using colvis the search boxes are not going invisible .
code is here ..
var noofcolumn= $('#example thead th').length;
colmn="";
for(i=0; i<noofcolumn; i++)
{
var title = $('#example thead th').eq( i ).text();
colmn+='<th><input type="text" placeholder="Search" /></th>';
}
$('#example tfoot').html( colmn );
// Apply the search
table.columns().every( function ()
{
$('input', this.footer() ).on( 'keyup change', function () {
table
.column( $(this).parent().index()+':visible' )
.search( this.value )
.draw();
} );
});
This discussion has been closed.