fnFilter

fnFilter

dinmor1337dinmor1337 Posts: 4Questions: 0Answers: 0
edited May 2013 in General
I have a table with alot of numbers, and i want to filter it so that it shows everything above my value

so if the value is lets say 11 i want it to show all with a number higher than 11, right now it shows values that contains 11. eg. 111, 211 etc.

var iValue = jQuery('#div').slider("value");

iTable.fnFilter(iValue , 1 );

Replies

  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    You will need to use a Range Filter.

    http://www.datatables.net/release-datatables/examples/plug-ins/range_filtering.html

    Are you using the Jquery Slider? If so there are a few posts on here about using it with DataTables


    This is an example of a filter you can use. I modified the example on the site.

    [code]

    $.fn.dataTableExt.afnFiltering.push(
    function( oSettings, aData, iDataIndex ) {
    //min value
    var iSlider = $('#slider').slider( "value" );
    //column to sort on
    var iVersion = aData[3] == "-" ? 0 : aData[3]*1;

    if ( iSlider == "")
    {
    return true;
    }
    else if ( iVersion >= iSlider )
    {
    return true;
    }

    return false;
    }
    );



    [/code]

    I also posted an example on jsbin of using the Slider and datatables. I ran into a few issues but is this what you are looking for?

    http://live.datatables.net/usobox
  • dinmor1337dinmor1337 Posts: 4Questions: 0Answers: 0
    Yes this is what i was looking for. Thank you very much.
  • dinmor1337dinmor1337 Posts: 4Questions: 0Answers: 0
    I can't get this to work when i load the table dynamicly

    like this:

    $(document).ready(function() {
    oTable = $('#example').dataTable(
    {
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "processing.php"
    }
  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    If you are using server-side processing, then the filtering is done at the server, not the client (since it is server-side processing!). So any Javascript filters in the browser are irrelevant.

    Allan
This discussion has been closed.