javascript - Dynamically loading a database based on user text input -


I have an autocomplete widget that needs to return options from the database of the object.

By doing so, once the user selects an item, the widget chooses another hidden textfield from the particular object that they chose. - It has been used on all projects and previous projects

Although this special database is very large (44k + objects, many of the files are valid and have taken too long to load in practice) so we have Tried various ways to isolate the first letter of the object label has been the best.

As a result, I am trying to create a function that tracks user input in textfield and returns the first letter, then AJAX is then used for a file named that.

He said that I have not been fortunate enough to try to track user input at this level and it generally shows that some keystrokes for it to work everything when I Am I trying to fulfill on the first keystroke: Does anyone have any advice in better way of going about this purpose? Or why does the process not work directly?

My current non-working code is to track user input - it is used on page load:

  function startup () {console.log ( "Start"); $ ("#_Q0_Q0_Q0") ("Keyup", function () {console.log ("start ahead!"); If ($ ("# _Q0_Q0_Q0"). Val (). Length == 1) {console .log ("more start"); Change Country ($ ("#_Q0_Q0_Q0"). Val () [0]) ToUpperCase ());} else {console.log ("over or under");}}); }   

and an example of the data (dummy value):

  tag = [[label: "label", code: "1", refnum: "555555", La: "888", DCSF: "4444", type: "not applicable", position: "open", ur: "1", g: "north west"}, ....] ;   

Edit: Fix applied:
  • Change startupp to .change (function ) to .on ("keyup", function) - Keydown can also be used, this is a personal preference for me.

  • Changed Autocomplete in Settings minLength: 4, - As the data starts loading with the first letter Gives some additional division MS to load the data before providing this option

  • How the source was collected by changing autocomplete It has been changed. Settings on the following:

    Source: function (request, response) {var results = $ .ui.autocomplete.filter (tag, request.term); Reaction (results.slice (0, 20)); },

    Where the data is array with data.

    All are working now.

    You must be connected to the keydown event:

      function startupp () {Console.log ("start"); $ ("#_Q0_Q0_Q0") keydown (function () {console.log ("start ahead!"); If ($ (this) .length () == 1) {console.log ("start over"); Change Country ($ (this ($ (this) .val () [0]) toupperCase ());} else {console.log ("over or under");}}); }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -