Load Material UI AutoComplete suggestions after user input

Leminur

I have an Autocomplete component that is required to load a massive data list (up to 6000 elements) and show suggestions accordingly to the user's input.

As the data options have so many elements, whenever the user starts typing in a slow computer, it slows down and requires some time to load everything. I have to prevent it, so I came with an idea to show the user suggestions after they typed the third character. It's even giving me this error whenever the user clicks on the input box:

Warning: React instrumentation encountered an error: RangeError: Maximum call stack size exceeded console.

I need to show the suggestions after the third character input. I have tried to use the getOptionDisabled suggestion and the limitTags, but they did not work.

Here is the code:

const NameSelect = (props) => {
  return (
    <Dialog>
        <React.Fragment>
          <DialogTitle id="search-name-dialog-title">
            Search name
          </DialogTitle>
          <DialogContent>
                <Autocomplete
                  id="combo-box-client-select"
                  options={props.NameList}
                  value={props.preSelectedName}
                  
                  getOptionLabel={(option) =>
                    option.Name_name +
                    ", " +
                    option.country +
                    ", " +
                    option.city
                  }
                  onChange={(object, value) => {
                    props.preSelectedNameSet(value);
                  }}
                  renderInput={(params) => (
                    <TextField
                      {...params}
                      label="Search name"
                      variant="outlined"
                      fullWidth
                    />
                  )}
                />
              .
              .
              .
    </Dialog>
  );
};

Can someone please help me with that approach, or suggest a better one? Thanks!

Umesh Maharshi

Try something like this:

<Autocomplete
    inputValue={inputValue}
    onInputChange={(e) => setinputValue(event.target.value)}
    id="combo-box-demo"
    options={values}
    getOptionLabel={(option) => option}
    style={{ width: 300 }}
    renderInput={(params) => (
      <TextField {...params} label="Combo box" variant="outlined" />
    )}
    open={inputValue.length > 2}
  />

Use InputValue prop to trigger the auto complete drop down. Example : auto complete dropdown

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Load Material UI AutoComplete suggestions after user input

From Java

Display number of matching search options on Textfield input in Material UI Autocomplete

From Dev

jQuery UI Autocomplete Suggestions Not Closing on Select

From Dev

jQuery UI Autocomplete Suggestions Not Closing on Select

From Dev

Kendo UI MVC Autocomplete server filtering after user stop typing

From Dev

Elm Autocomplete On User Input

From Dev

Add footer with link in list of suggestions in autocomplete material angular

From Dev

polymer paper-input html datalist autocomplete/suggestions list

From Dev

Angular Materials: Can you disable the autocomplete suggestions for an input?

From Dev

Is there a GitHub API to get autocomplete suggestions for user/organization name?

From Dev

Add user's input to autocomplete

From Dev

Angular Material: md-autocomplete - how to hide md-autocomplete-suggestions on Enter event?

From Java

Problem with Autocomplete (Material UI + React + Reagent/ClojureScript)

From Java

Getting the value in the React material-UI Autocomplete

From Java

Handle change on Autocomplete Component from material ui

From Dev

react material ui autocomplete element focus onclick

From Dev

Problem to use Component Lab > Autocomplete of Material UI

From Dev

Getting selected value in Material-UI Autocomplete

From Dev

Material-UI Tabs inside AutoComplete popover

From Dev

How to implement jQuery UI autocomplete function to an input in a Modal appended after loading the document?

From Dev

Autocomplete suggestions not shown after all chips removed (md-chips + md-autocomplete)

From Dev

Autocomplete suggestions not shown after all chips removed (md-chips + md-autocomplete)

From Dev

JQuery autocomplete suggestions not sorted

From Dev

JQuery autocomplete suggestions not sorted

From Dev

WKWebView autocomplete suggestions in UITextField

From Dev

Semantic UI - search autocomplete with dynamics input

From Dev

Pass input id to url in jquery ui autocomplete

From Dev

Jquery ui autocomplete force user to pick answere

From Dev

Binding jQuery Autocomplete after Page Load

Related Related

  1. 1

    Load Material UI AutoComplete suggestions after user input

  2. 2

    Display number of matching search options on Textfield input in Material UI Autocomplete

  3. 3

    jQuery UI Autocomplete Suggestions Not Closing on Select

  4. 4

    jQuery UI Autocomplete Suggestions Not Closing on Select

  5. 5

    Kendo UI MVC Autocomplete server filtering after user stop typing

  6. 6

    Elm Autocomplete On User Input

  7. 7

    Add footer with link in list of suggestions in autocomplete material angular

  8. 8

    polymer paper-input html datalist autocomplete/suggestions list

  9. 9

    Angular Materials: Can you disable the autocomplete suggestions for an input?

  10. 10

    Is there a GitHub API to get autocomplete suggestions for user/organization name?

  11. 11

    Add user's input to autocomplete

  12. 12

    Angular Material: md-autocomplete - how to hide md-autocomplete-suggestions on Enter event?

  13. 13

    Problem with Autocomplete (Material UI + React + Reagent/ClojureScript)

  14. 14

    Getting the value in the React material-UI Autocomplete

  15. 15

    Handle change on Autocomplete Component from material ui

  16. 16

    react material ui autocomplete element focus onclick

  17. 17

    Problem to use Component Lab > Autocomplete of Material UI

  18. 18

    Getting selected value in Material-UI Autocomplete

  19. 19

    Material-UI Tabs inside AutoComplete popover

  20. 20

    How to implement jQuery UI autocomplete function to an input in a Modal appended after loading the document?

  21. 21

    Autocomplete suggestions not shown after all chips removed (md-chips + md-autocomplete)

  22. 22

    Autocomplete suggestions not shown after all chips removed (md-chips + md-autocomplete)

  23. 23

    JQuery autocomplete suggestions not sorted

  24. 24

    JQuery autocomplete suggestions not sorted

  25. 25

    WKWebView autocomplete suggestions in UITextField

  26. 26

    Semantic UI - search autocomplete with dynamics input

  27. 27

    Pass input id to url in jquery ui autocomplete

  28. 28

    Jquery ui autocomplete force user to pick answere

  29. 29

    Binding jQuery Autocomplete after Page Load

HotTag

Archive