Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Quick Search element issue


in your docs:
https://preview.keenthemes.com/html/metronic/docs/general/search

for using this search you are using some timeout (I guess for wait for user finish typing), but we have an issue that if the user will type a character just before the process will finish, his new input will not take in account in your search.

this is because you are not reinitialize the "processing" value in when "_input" method is occure.




var _input = function() {
if ( _getOption("min-length") ) {
the.processing = false; // < ------------------------
if ( the.inputElement.value.length >= the.minLength ) {
_search();
} else if ( the.inputElement.value.length === 0 ) {
_clear();
}
}
}


if you add it to your code, there is no need of "timeout" or reduce to 100ms or 200,s and everything will work directly.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi,

The 1500-second timeout is used for demo purposes only. You can remove it and replace the code with the actual Ajax request processing code. You can fully customize the code as per your requirements.

Regards.



If we remove the timeout the ajax requests not working properly because of the "processing" because its become false, if user types fast it not taking the last input.



Hi,

Noted, then you can adjust the timeout according to your project requirements. I hope it will fully solve your issue.

Regards.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(