Multiple range filters

Multiple range filters

fernandes.glenfernandes.glen Posts: 2Questions: 0Answers: 0
edited February 2010 in General
Hi,
how can i have more than on range filter.
currently i have 3 datatables and want to associate a date range filter with each of them.
i tried the example but it filters all the tables wilth the same date.

Thanks in advance

Glen

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Glen,

    Within the afnFiltering function you will need to make use of a reference to the filtering input for that specific table. What I would perhaps suggest is to make use of fnInitComplete and attach the filtering inputs for the table that has been initialised to oSettings (which is unique to each table) - and then use those properties in the filtering function.

    Allan
  • fernandes.glenfernandes.glen Posts: 2Questions: 0Answers: 0
    Hi Allan,

    thanks for the reply. can you please give a small code example

    Thanks
  • stormlifterstormlifter Posts: 15Questions: 0Answers: 0
    I too would like to have a small code sample to get me started.
  • rfloresrflores Posts: 1Questions: 0Answers: 0
    There is a solution:

    [code]
    $.fn.dataTableExt.afnFiltering.push(
    function(oSettings, aData, iDataIndex) {
    if (oSettings.sTableId == "TableName1") {
    var iMin = document.getElementById('text-min-01').value * 1;
    var iMax = document.getElementById('text-max-01').value * 1;
    ... etc ...
    }
    if (oSettings.sTableId == "TableName2") {
    var iMin = document.getElementById('text-min-02').value * 1;
    var iMax = document.getElementById('text-max-02').value * 1;
    ... etc ...
    }
    return false;
    }
    );
    [/code]

    don't forget event listeners.

    It works fine.... ! (my version: 1.7.2)

    Regards,
This discussion has been closed.