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

Table search callback should be debounced? #556

@jlas

Description

@jlas

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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions