hello I have two select in one I have to send the selected data together with the id and the clientValue, and the second select must send only the selected string value, but I don't really understand how to do it
<script> let chores: Chore []= []; let types : EquipmentType[] = []; $: choreOptions = chores.map((c:Chore) => new deviceOption(c.id,c.name)); $: typesOptions = types.map((t:EquipmentType) => { return t.name }); let data = undefinded function selectionOpt(event){ data = event.detail } onMount(() => { getChoreDevices() .then( chrs => { chores = chrs; console.debug(chores); }) .catch(e => { console.error(e); }) getEquipmentTypes() .then( ts => { types = ts; console.debug(types); }) .catch( e => { console.error(e); }); } </script> <div class="form-group"> <label for="">Chore:</label> <Select items={choreOptions} on:select={selectionOption}></Select> </div> <div class="form-group"> <label for="">Type:</label> <Select items={typesOptions} on:select={selectionOptType}></Select> </div><br>
2.1m questions
2.1m answers
60 comments
57.0k users