Post

Mui Autocomplete Fetch Data

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<Autocomplete
	multiple={false}
	options={natOption}
	id="natcod_descr"
	name="natcod_descr"
	onChange={handleNatOptionChange}
	value={data.natcod_descr ? {"DESCR": data.natcod_descr} : null}
	getOptionLabel={(option) => `${option.DESCR}`}
	renderOption={(props, option) => (
		<Box {...props}>
			{option.DESCR}
		</Box>
	)}
	onInputChange={onNatInputChange}
	renderInput={(params) => (
		<TextField
			{...params}
			label="國籍一"
			variant="outlined"
		/>)}
	isOptionEqualToValue={(option, value) => option.DESCR === value.DESCR}
	filterOptions={(x) => x}
/>
This post is licensed under CC BY 4.0 by the author.