Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-selected auto complete multiple #216

Open
gponty opened this issue Jan 26, 2024 · 0 comments
Open

Pre-selected auto complete multiple #216

gponty opened this issue Jan 26, 2024 · 0 comments

Comments

@gponty
Copy link

gponty commented Jan 26, 2024

Hi,
Thank you for your good job, but i have a question, it's possible to pre-select, like this :


<script>
import AutoComplete from 'simple-svelte-autocomplete';

	const colorList = [
  { id: 1, name: "White", code: "#FFFFFF" },
  { id: 2, name: "Red", code: "#FF0000" },
  { id: 3, name: "Yellow", code: "#FF00FF" },
  { id: 4, name: "Green", code: "#00FF00" },
  { id: 5, name: "Blue", code: "#0000FF" },
  { id: 6, name: "Black", code: "#000000" }
];

let selectedColorsItems = [
	{ id: 1, name: "White", code: "#FFFFFF" }
];
let selectedColorsValues = [1];
	
</script>

<AutoComplete
    multiple=true
    orderableSelection=true
    items={colorList}
    labelFieldName="name"
    valueFieldName="id"
    bind:selectedItem={selectedColorsItems}
    bind:value={selectedColorsValues}
    />

REPL : https://svelte.dev/repl/ef51e70ba1894da291048bcbdb287661?version=4.2.9

(this example doesnt work but may be i made a mistake).

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant