Skip to content
This repository has been archived by the owner on Jun 10, 2020. It is now read-only.

Table search callback should be debounced? #556

Open
jlas opened this issue Sep 19, 2016 · 1 comment
Open

Table search callback should be debounced? #556

jlas opened this issue Sep 19, 2016 · 1 comment
Labels

Comments

@jlas
Copy link

jlas commented Sep 19, 2016

At main.js:17 the location.hash is being updated multiple times as the user types in their query. The search function seems to work fine but clicking the back button causes the app to backtrack through each incremental search update. e.g. If the user searches for "asdf", the 1st back button click sets location.hash to "asd", the 2nd to "as", and so on.

This might easily be resolved by using a debounce function from a library like lodash, e.g.

  $('table').on('search.dt', _.debounce(function(e, settings) {
    var query = $("input[type=search]").val();
    if (query)
      location.hash = QueryString.stringify({q: query});
    ...
  }, 1000));
@konklone
Copy link
Contributor

I totally agree. I'm not sure when this will be prioritized, but this is a constant annoyance for me as well.

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

No branches or pull requests

4 participants