当前位置:网站首页>Antdpro - protable realizes the linkage effect of two selection boxes
Antdpro - protable realizes the linkage effect of two selection boxes
2022-06-13 00:39:00 【We are all lemonade】
Realization effect
1) Under normal circumstances ,a It's normal ,b Is disabled 
2) When choosing a when , Will be released b Disabled state of , And give b The drop-down data assignment of the selection box of 
3) choice b, And empty a Value , Should be cleared and disabled b, Return to the initial state 

4) Click on “ Reset ”, Return to the initial state

Key code :
......
const [eleValue, setEleValue] = useState<any>(undefined); // b Value
const [labelDisabled, setLabelDisabled] = useState<boolean>(true); // b Whether to disable
const [hideSearchLabel, setHideSearchLabel] = useState<string>(''); // b option Value
const columns: ProColumns<TableListItem>[] = [
{
title: 'a',
dataIndex: 'domainCode',
hideInTable: true,
valueEnum: typeEnum,
fieldProps: {
placeholder: ' Please select a',
onChange: (val: any) => {
setEleValue(undefined); // 1、 When a When the change , Will be emptied first b The selected value or the remaining warning message ;
// 2、 There is value , Explain that you are choosing a Drop down value for , Need to be lifted b Disabled state of ;
if (val) {
setLabelDisabled(false);
} else {
// 3、 Value does not exist , explain a The selection box is cleared , It needs to be disabled again ;
setLabelDisabled(true);
}
},
},
search: {
transform: (value) => {
setHideSearchLabel(value); // to update a The type of , convenient b And then change options The value of
return {
domainCode: value };
},
},
},
{
title: 'b',
dataIndex: 'elementLabel',
ellipsis: true,
valueEnum: elementEnum,
fieldProps: {
placeholder: ' Please select b',
onChange: (val: any) => {
setEleValue(val); // to update b Value
},
},
renderFormItem: () => (
<ProFormSelect
wrapperCol={
{
span: 24 }}
disabled={
labelDisabled}
value={
eleValue}
options={
// according to a Type value of
hideSearchLabel === 'OFFICIAL_DOCUMENT'
? officialElementOption
: hideSearchLabel === 'SERVICE_DOCUMENT'
? govServiceElementOption
: []
}
/>
),
},
]
......
边栏推荐
- 6.824 Lab 3A: Fault-tolerant Key/Value Service
- TypeError: wave.ensureState is not a function
- [supersocket 2.0] supersocket 2.0 from the beginning to the end
- Solution to the problem of closing the watchdog of STM32 in the sleep mode (stop/standby)
- Go implements concurrent non blocking caching
- [LeetCode]9. Palindromes thirty-two
- 新增博客地址
- [colorful] Net dto mapping
- Five mock technologies of go
- Win10 home vs pro vs enterprise vs enterprise LTSC
猜你喜欢

Kali system -- host, dig, dnsenum, imtry for DNS collection and analysis

The origin of MySQL in bedtime stories

1. Google grpc framework source code analysis Hello World

Summary of openstack installation problems
![BUUCTF之BabySQL[极客大挑战 2019]](/img/6c/957e5e09f252210d0b4cf8771d4ade.png)
BUUCTF之BabySQL[极客大挑战 2019]

Target recognition gadget

Stm32f4 development of DMA transmission to GPIO port

硬(磁)盘(一)
![[MRCTF2020]Ez_ bypass --BUUCTF](/img/73/85262c048e177968be67456fa4fe02.png)
[MRCTF2020]Ez_ bypass --BUUCTF

Arduino control soil moisture sensor
随机推荐
ImportError: cannot import name &#039; get_ ora_ doc&#039; from partially initialized module
[GYCTF2020]Ezsqli --BUUCTF
浏览器控制台注入JS
Kali system -- fierce of DNS collection and analysis
Transaction creation of btcd transaction process (I)
Development notes of Mongoose
Assembly language learning
Penetration test summary
Delphi Chinese digit to Arabic digit
[LeetCode]28. Implement strstr()
[GXYCTF2019]禁止套娃--详解
Basic operations of FreeMarker
Context of go concurrency mode
6.824 Lab 4B: Sharded Key/Value Service
Opencv face recognition of ros2 foxy~galactic~humble
2022施工員-設備方向-通用基礎(施工員)操作證考試題及模擬考試
[supersocket 2.0] supersocket 2.0 from the beginning to the end
Lambda expression
63. 不同路径 II
Maybe we can figure out the essence of the Internet after the dust falls