I have a form in which there is a multi select dropdown antd component . On change of the select all option , I need to select all the options available with max of 5 tags .
Please find the link of my code in codesandbox here https://codesandbox.io/s/summer-wind-1swto
Max tag of 5 is sepecified with handleSelectAll function is called on select of options
<Form.Item label= 'Column Names'>
{getFieldDecorator(`columnNames`, {
validateTrigger: ['onChange', 'onBlur'],
rules: [
{
required: true,
message: "Please input the Column Names!",
},
],
})(
<Select
mode="multiple"
placeholder="Please select Columns"
maxTagCount={5}
onChange={this.handleSelectAll}
>
<Option key="all" value="all">---SELECT ALL---</Option>
{children}
</Select>
)}
</Form.Item>
Expected:
On select all is clicked all the options to be selected
On unchecking it all options to be removed