Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delay key stroke for filter #167

Closed
wants to merge 1 commit into from
Closed

Conversation

longprao
Copy link

@longprao longprao commented Jan 3, 2014

Added ability to add a delay for filter.

Test passed.

Usage:

$scope.tableParams = new ngTableParams({
    page: 1,            // show first page
    count: 10,          // count per page
    sorting: {
        _id: 'desc'     // initial sorting
    }
}, {
    total: 10,           // length of data
    filterDelay: 750,    // default value (milliseconds)
    getData: function($defer, params) {
        Transaction.get(params.url(), function(data) {
            params.total(data.total);
            $defer.resolve(data.data);
        });
    }
});

@longprao
Copy link
Author

longprao commented Jan 3, 2014

#137

#119

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 0242a33 on longprao:master into c83e219 on esvit:master.

@dylanlgs
Copy link

dylanlgs commented Jan 3, 2014

+1

Might also be nice to have a minimum number of characters for live filtering, or a incremental character filter. For instance, if filtering by a state (US states, or provinces in other countries) field, you may want to filter by 2 characters for postal abbreviations, but at least 4 characters for full state name, since the shortest one "Utah" has 4 chars.

@darioguarascio
Copy link

Definitely a must-have feauture. Thanks @longprao

@darioguarascio
Copy link

Did you think about custom filters ? I created a drop down one, and the delay affects that as well.
It would be great to have the delay being applied only to free input, not fixed ones like dropdowns, checkboxes, radio, etc.

@esvit
Copy link
Owner

esvit commented Feb 11, 2014

thanks, I added your changes to master branch

@esvit esvit closed this Feb 11, 2014
@lijuenc
Copy link
Contributor

lijuenc commented Mar 25, 2014

Echoing what @disfasia said.

While having a filter delay on keystrokes is nice, the filterDelay setting currently applies to all filters on an ngTable. This means that whether or not the filter values come from a textbox (where a keystroke delay makes sense) or another source like the value of a drop-down select (where a keystroke delay does not make sense), there will always be a [###]ms delay.

If your tables use a combination of textbox and non-textbox sources for filters, the delay can get pretty jarring. My workaround right now is to just use a filterDelay of 0 across the board.

@qharlie
Copy link

qharlie commented May 7, 2014

Brilliant thanks @longprao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants