Open Branteagle opened 3 months ago
Sorry about bugging about this, however, I did figure out how to and the onChange event to the selection made.
Add this to the schema.json file
{ "type": "event", "label": "On Change", "key": "onChange", "context": [ { "label": "Field Value", "key": "value" } ] }
Add this to Component.svelte
export let onChange;
const handleChange = e => { if (onChange) { onChange({ value: e.detail }); } };
Change this in Component.svelte
function changeHandler(e) { console.log('selectedItem', selectedItem) console.log('changeHandler', e); console.log('searcheventhandler', searchEvent); if (selectedItem) { fieldApi?.setValue(selectedItem[valueFieldName]); handleChange({ detail: selectedItem[valueFieldName] }); } }
Sorry about bugging about this, however, I did figure out how to and the onChange event to the selection made.
Add this to the schema.json file
{ "type": "event", "label": "On Change", "key": "onChange", "context": [ { "label": "Field Value", "key": "value" } ] }
Add this to Component.svelte
export let onChange;
Add this to Component.svelte
const handleChange = e => { if (onChange) { onChange({ value: e.detail }); } };
Change this in Component.svelte
function changeHandler(e) { console.log('selectedItem', selectedItem) console.log('changeHandler', e); console.log('searcheventhandler', searchEvent); if (selectedItem) { fieldApi?.setValue(selectedItem[valueFieldName]); handleChange({ detail: selectedItem[valueFieldName] }); } }