带有默认值的react-admin Selectinput

时间:2020-06-22 14:53:58

标签: react-native react-admin

是否可以使用选择的默认值呈现SelectInput?我需要使用所选的默认语言加载页面。谢谢。

我的代码:


export const CT_SELECT_I18N = [
    {id: 'en', text: 'English'},
    {id: 'pt', text: 'Português'},
    {id: 'es', text: 'Español'},
];

const renderSelect = ({
                          meta: {touched, error} = {},
                          input: {...inputProps},
                          ...props
                      }) => (
    <SelectInput
        error={!!(touched && error)}
        helperText={touched && error}
        {...inputProps}
        {...props}
        fullWidth
        source="idioma"
        choices={Constants.CT_SELECT_I18N}
        translateChoice={false}
        optionValue="id"
        optionText="text"
    />
);

1 个答案:

答案 0 :(得分:0)

为此使用道具****************************************** Timestamp | SB1_AC_Total | Needed information (delta) ****************************************** 2020-06-24 09:32:45 | 11.326.302 | 23 2020-06-24 09:32:02 | 11.326.279 | 22 2020-06-24 09:31:20 | 11.326.257 | ...

您的selectinput看起来像

initialValue

更多内容:https://marmelab.com/react-admin/Inputs.html#common-input-props

相关问题