wip
This commit is contained in:
		| @@ -73,16 +73,27 @@ | ||||
| 		); | ||||
| 	}; | ||||
|  | ||||
| 	let selectRef; | ||||
| 	// function resetComponent() { | ||||
| 	// 	if (selectRef) { | ||||
| 	// 		selectRef.reset(); | ||||
| 	// 		console.log("Component state reset"); | ||||
| 	// 	} | ||||
| 	// } | ||||
|  | ||||
| 	function resetAll() { | ||||
| 		runnerinfo = { id: 0, firstname: "", lastname: "" }; | ||||
| 		donorinfo = { id: 0, firstname: "", lastname: "" }; | ||||
| 		amount = 0; | ||||
| 		address_checked = false; | ||||
| 		donor_create_new = false; | ||||
| 		const clears = document.querySelectorAll(".clearSelect"); | ||||
| 		clears.forEach((c) => { | ||||
| 			c.click(); | ||||
| 		}); | ||||
| 		// const clears = document.querySelectorAll(".clearSelect"); | ||||
| 		// clears.forEach((c) => { | ||||
| 		// 	c.click(); | ||||
| 		// }); | ||||
| 		// resetComponent(); | ||||
| 		selectRef.reset(); | ||||
| 		document.querySelector("#jjqzqicxujrnnh1x3447x18x").focus(); | ||||
| 	} | ||||
| </script> | ||||
|  | ||||
| @@ -105,6 +116,8 @@ | ||||
| 			<!--  --> | ||||
| 			<h4 class="text-xl font-semibold">{$_("runner")}</h4> | ||||
| 			<VirtualSelect | ||||
| 				inputElementID="jjqzqicxujrnnh1x3447x18x" | ||||
| 				bind:this={selectRef} | ||||
| 				autofocus={true} | ||||
| 				on:onClear={() => { | ||||
| 					console.log("Cleared selection"); | ||||
|   | ||||
| @@ -91,6 +91,18 @@ | ||||
| 		dispatch("onClear"); | ||||
| 	} | ||||
|  | ||||
| 	// Reset component state | ||||
| 	export function reset() { | ||||
| 		selected = null; | ||||
| 		searchTerm = ""; | ||||
| 		isOpen = false; | ||||
| 		focusedIndex = -1; | ||||
| 		startIndex = 0; | ||||
| 		updateVisibleItems(); | ||||
| 		dispatch("onSelected", null); | ||||
| 		dispatch("onClear"); | ||||
| 	} | ||||
|  | ||||
| 	// Toggle dropdown | ||||
| 	async function toggleDropdown() { | ||||
| 		isOpen = !isOpen; | ||||
| @@ -273,6 +285,8 @@ | ||||
| 			<path | ||||
| 				stroke-linecap="round" | ||||
| 				stroke-linejoin="round" | ||||
| 				stroke | ||||
| 				Politeness="round" | ||||
| 				stroke-width="2" | ||||
| 				d="M19 9l-7 7-7-7" | ||||
| 			/> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user