2017-09-21 39 views

回答

-1

您需要编写一个自定义的redux连接组件,该组件将包装referenceInput并根据状态中的选定值提供过滤器值。

您可以从state.admin.form访问当前数据。 “YOURFORMNAME” Redux的形式还提供了可以用在其他设备

https://redux-form.com/7.0.4/docs/api/selectors.md/

class ConnectedInput extends Component { 


    componentWillRecieveProps = (nextProps, currentProps) => { 
     if (nextProps.userName !== currentProps.userName) { 
      //reset state to set the the filter to query property based on new props and forcing a rerendering which will make the db call 
     } 
    } 

    render() { 
     return (
       <ReferenceInput filterToQuery={this.state.filter}> 
        <DisplayComponent /> 
       </ReferenceInput> 
     ) 
    } 

    mapStateToProps =() => { 
     const userName = //get from the state 
     return userName 
    } 
} 
0

aor-dependent-input访问值可以帮助你与一些实用功能。你可以在README

+0

找到一个接近你想要的例子如果依赖于aor的输入工作,那么它将是这个问题的理想解决方案。 –

+0

我必须说我还没有时间用最新的aor版本来测试它。如果您遇到任何问题,请让我知道 – Gildas