Pressing esc on column filter

Pressing esc on column filter

GrantSoldgeGrantSoldge Posts: 4Questions: 0Answers: 0
edited August 2012 in Bug reports
Hi everyone,

when I focus on a column filter field, the info text (for example "Search engines") disappears and field is empty. But when I press the esc key without entering any char, the info text appears again and becomes value of the field and column is filtered according to "Search engines".

Have a nice day,

Grant

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    In this example: http://datatables.net/release-datatables/examples/api/multi_filter.html ? I don't seem to get the same effect as you - the info text doesn't reappear for me (using Safari).

    Allan
  • GrantSoldgeGrantSoldge Posts: 4Questions: 0Answers: 0
    Oh ok, I have just tried with IE and Chrome and it works. It seems to be a problem of Firefox. Thanks for your reply.

    Grant
  • GrantSoldgeGrantSoldge Posts: 4Questions: 0Answers: 0
    I have found a solution. It may be usefull for others:

    [code]
    $("tfoot input").keydown(function(e) {
    if(e.keyCode == 27) {
    $(this).addClass("search_init");
    }
    });
    [/code]

    Grant
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Nice one - thanks!

    Allan
  • GrantSoldgeGrantSoldge Posts: 4Questions: 0Answers: 0
    edited August 2012
    Better:

    [code]
    $("tfoot input").keyup(function(i) {
    if(i.keyCode == 27) {
    this.className = "search_init";
    this.value = settings.asInitVals[$("tfoot input").index(this)];
    settings.oTable.fnFilter("", $("tfoot input").index(this));
    } else {
    this.className = "";
    settings.oTable.fnFilter(this.value, $("tfoot input").index(this));
    }
    });
    [/code]

    Grant
This discussion has been closed.