Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(