trigger search
trigger search
Userccc
Posts: 1Questions: 1Answers: 0
Hy,
What I'm missing here.
If remove the trigger and replace the min/max in the $.fn.dataTable.ext.search.push is working ok.
If I try to trigger the filter on click nothing happen.
Thank you
``
var min;
var max;
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var min = parseFloat(min);
var max = parseFloat(max);
var col = parseFloat( data[7] ) || 0; // data[number] = column number
if ( ( isNaN( min ) && isNaN( max ) ) ||
( isNaN( min ) && col <= max ) ||
( min <= col && isNaN( max ) ) ||
( min <= col && col <= max ) )
{
return true;
}
return false;
}
);
$(document).ready(function() {
var table = $('#coin_table').DataTable( {
//fixedHeader: false,
"columnDefs": [
{ "orderable":false, "targets":[0,1,3]},
{ "type": "title-numeric", "targets":[2,5,6,9,11]}
]
} );
$('#test').click(function() {
min=600;
max=1000;
table.draw();
});
} );
``
This discussion has been closed.
Answers
try giving min and max variables different names that what is inside your function