redux-form-material-ui | SelectField |自定义onChange可防止显示所选值

时间:2016-06-17 08:02:49

标签: javascript reactjs redux material-ui redux-form

我使用redux-formredux-form-material-ui来创建一些简单的表单。 subdepartment选择中的值取决于department选择中选择的值。所以我创建了一个在department选择的更改时触发的回调函数。获取subdepartment选择的数据有效,但选择的值department选择不再出现。

import React from 'react';
import { Field } from 'redux-form';
import { SelectField } from 'redux-form-material-ui';
import MenuItem from 'material-ui/MenuItem';

<Field
  name={name}
  component={SelectField}
  hintText={label}
  floatingLabelText={label}
  onChange={callback}
>
  {this.renderOptions(options)}
</Field>

回调:

searchSubdepartments: departmentId => dispatch(searchSubdepartments(departmentId))

0 个答案:

没有答案