Autocomplete preline #364
TuvikCarsales
started this conversation in
General
Replies: 1 comment
-
Hi.. Did u get anything so far? I face same problem the templates here almost like top secret codes, no documentation no help nothing is clear and cannot be changed so easily because we don't understand it clearly :S |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can't find an example with https://preline.co/docs/combobox.html#basic-usage. An example there with api connection. The field is apiUrl. What if I want to call the api before calling the element? What if I want to put it as a variable? I must admit that the documentation is very limited and bad. It doesn't include live examples.
If I do something like that, I am getting error
const Autocomplete: React.FC = () => {
const [items, setItems] = useState("https://freetestapi.com/api/v1/countries");
const dataAuto = {
"apiUrl": "https://freetestapi.com/api/v1/countries",
"outputItemTemplate": "<div className="cursor-pointer py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-gray-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800" data-hs-combo-box-output-item><div className="flex justify-between items-center w-full">
};
return (
<>
<div className="absolute z-50 w-full max-h-72 p-1 bg-white border border-gray-200 rounded-lg overflow-hidden overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900 dark:border-neutral-700"
style={{ display: "none" }} data-hs-combo-box-output="">
Error:
Uncaught SyntaxError: "[object Object]" is not valid JSON
at JSON.parse ()
at preline.js:41:19255
at NodeList.forEach ()
at e3.autoInit (preline.js:41:19050)
at preline.js:41:22859
Beta Was this translation helpful? Give feedback.
All reactions