我想要的是,当我从模板下拉列表中选择一个特定值时,注释文本框应显示基于 Templates中所选值的值下拉。
<Form.Item label="Templates" name="Templates">
<Select size="small"
placeholder="Select..."
allowClear
showSearch
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
onChange ={(e) =>
{
const newValue = e;
const {change} = this.props
change('Note', _.find( MasterData.NotesTemplates, { TemplateLabel: newValue }).TemplateText)
this.setState({selectedTemplate: newValue});
}
}
>
{MasterData && MasterData.NotesTemplates && MasterData.NotesTemplates.map((dd)=><Select.Option value={dd.TemplateLabel}>{dd.TemplateLabel}</Select.Option>)}
</Select>
</Form.Item>
<Form.Item label="Note" name="Note" rules={[{required:true,message:'Please Input!'}]}>
<Input.TextArea autoSize size="small" />
</Form.Item>
我在change
中使用了onChange
函数,但出现此错误
TypeError:change不是函数
我可以使用哪些内置函数代替change
?
答案 0 :(得分:0)
找出答案
this.form.setFieldsValue({'Note': _.find( MasterData.NotesTemplates, { TemplateLabel: newValue }).TemplateText})