Text click GREATER THAN 0 and LESS THAN 0 filter?

Text click GREATER THAN 0 and LESS THAN 0 filter?

OnaksGarajOnaksGaraj Posts: 1Questions: 1Answers: 0
edited January 2021 in Free community support

I want to create custom filter for greater or less than 0 from clicked text link.


$.fn.dataTable.ext.search.push( function( settings, data, dataIndex ) { var balance = parseFloat( data[3] ) || 0; // use data for the balance column if ( balance > 0 ) { return true; } return false; } ); $(document).ready(function() { var table = $('#example').DataTable(); $('#positiveBalance').on('click', function () { table.draw(); }); } ); <a href="#" id="positiveBalance">Positive Balance</a>

I tired this code for Positive Balance but not work. How can I make it for positive and negative balance?

Answers

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    I tired this code for Positive Balance but not work

    Glancing through your code it looks like it should work. However its hard to say without seeing your data, etc. Have you tried debugging the data[3] and balance values to see how the code works?

    Start by posting a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

This discussion has been closed.