Problem with fnFilter

Problem with fnFilter

ctct Posts: 9Questions: 0Answers: 0
edited November 2010 in KeyTable
Hi, I've the following code in place:

[code]
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();

$('#quick_search').live('keyup', function() {
delay(function(){
var SearchTerm = $("#quick_search").val();
if (SearchTerm.length == 1) {
oTable.fnFilter("^"+SearchTerm, 1, true,false);
} else {
oTable.fnFilter(SearchTerm);
}
}, 1000 );
});

[/code]


This code filters rows starting with a character in second column if only one character is supplied. Which it does. However, when the character is removed, it does not return the table to it's unfiltered state.

Did I miss something? Before I added the
[code]
if (SearchTerm.length == 1) {
oTable.fnFilter("^"+SearchTerm+"", 1, true,false);
}
[/code]
condition it used to work.

Thanks

Replies

  • ctct Posts: 9Questions: 0Answers: 0
    edited November 2010
    bah, figured it out.

    Had to do a
    [code]
    oTable.fnFilter("", 1, false,false);
    [/code]

    to "unfilter" first. :-)
This discussion has been closed.