Choices icon indicating copy to clipboard operation
Choices copied to clipboard

The search field is not shown.

Open ochov1 opened this issue 4 years ago • 3 comments

I have the Choices in React, no error the choices are loaded with axios correctly, but the search field is not loaded even if I force loading with the options.

I paste my code.

 useEffect(()=>{
                axios.get("/api/maps?page=1&search="+"gel",{
                    headers:{
                        "Content-Type": "application/json",
                        accept: "application/json"

                    }
                }).then(response => {

                    new Choices(document.getElementById("choices"),{
                        choices:response.data,
                        searchChoices: true,
                        removeItemButton: true,
                        searchFields: ["label", "value"],
                        loadingText: "Loading...",
                        placeholder: true,




                    })
                })


            },[])





        return(
            <>

                <select
                    multiple={false}

                    className="form-control"
                    id="choices"

                />

            </>
        )

Thank you.

ochov1 avatar Jan 22 '21 12:01 ochov1

@ochov1 , were you able to solve this?

einazare avatar Mar 05 '21 13:03 einazare

@EINazare no, this is still not working.

ochov1 avatar Mar 06 '21 13:03 ochov1

@ochov1 why not use setChoices?

example: https://codesandbox.io/s/hungry-einstein-v5c24

FahriDevZ avatar Jul 14 '21 08:07 FahriDevZ