Reset Column Filters (Select)

Reset Column Filters (Select)

AlvaroAlvaro Posts: 4Questions: 0Answers: 0
edited January 2011 in General
Hi Allan!

First i have to congratulate you for this wonderful framework :)

Well my problem is when i use the filter columns selectable in a table with over 60 columns, some times reset all the filters is a big problem. Its posible use a button to reset the all selectable filters?

Thank you !

Regards

Replies

  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    would you please elaborate more....
    if got you right then you might me needing this...fnFilterClear()
    http://www.datatables.net/plug-ins/api

    called this function on click of button...
  • AlvaroAlvaro Posts: 4Questions: 0Answers: 0
    Thank you very much vivek!!!

    Was too useful that code, but I have just 1 problem, all is working but i tryed to reset the select filter (without text on selector) but i dont get it.
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    fnFilterClear will clear the filter in DataTables - but it won't clear any text or the selected option from input or select elements (since DataTables doesn't know anything about that). For that, you will need to use a little bit of jQuery to clear the inputs / selects.

    Allan
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    use this..
    [code]
    $("input:button").click(function(e) {
    $('#inputId').val(''); // reset the value to empty
    });
    [/code]
  • AlvaroAlvaro Posts: 4Questions: 0Answers: 0
    Hi All, first thank you both for your help.
    I got solve the problem with this jquery plugin called jquery.selectboxes.js

    http://www.texotela.co.uk/code/jquery/select/

    And the code was this

    for the button
    [code]function fnResetFilters()
    {
    var oTable = $('#example').dataTable();
    /* Remove all filtering */
    oTable.fnFilterClear();
    $("select").selectOptions("");
    }[/code]


    The rest is the same in the api link that vivek put abobe

    Regards
This discussion has been closed.