Hide rows after button click
Hide rows after button click
Hi,
I have some to filter a certain table and what I need is a way to hide rows with the selected options when the user clicks a button SEARCH.
I've saw in the forum a function using afnFiltering but I'm having difficulties to have it to work right.
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var nTr = oSettings.aoData[ iDataIndex ].nTr;
return true;
}
);
[/code]
I need a way to call this afnFiltering only if the user clicks SEARCH and for now it runs by itself and I've tried already to put it inside a function but when I call the function nothing happens.
This is what I have so far:
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var nTr = oSettings.aoData[ iDataIndex ].nTr;
if($(nTr).attr('user') === 'test123'){
return false;
}
}
);
$('#pesquisar').click( function(){
var user = $('#user_name').val();
var status = $('#estado').val();
var first_date = $('#first_date').val();
var last_date = $('#last_date').val();
$("#table_tarefas").dataTable().fnDraw();
});
[/code]
Thank you
I have some to filter a certain table and what I need is a way to hide rows with the selected options when the user clicks a button SEARCH.
I've saw in the forum a function using afnFiltering but I'm having difficulties to have it to work right.
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var nTr = oSettings.aoData[ iDataIndex ].nTr;
return true;
}
);
[/code]
I need a way to call this afnFiltering only if the user clicks SEARCH and for now it runs by itself and I've tried already to put it inside a function but when I call the function nothing happens.
This is what I have so far:
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var nTr = oSettings.aoData[ iDataIndex ].nTr;
if($(nTr).attr('user') === 'test123'){
return false;
}
}
);
$('#pesquisar').click( function(){
var user = $('#user_name').val();
var status = $('#estado').val();
var first_date = $('#first_date').val();
var last_date = $('#last_date').val();
$("#table_tarefas").dataTable().fnDraw();
});
[/code]
Thank you
This discussion has been closed.