2017-09-29 20 views
2

사이트 설정 패널에 AOR 1.2.2가 사용되었습니다.입력이 SimpleForm 내부에서 다시 렌더링되지 않음

const SettingsEdit = (props) => { 
    return (
    <Edit actions={<SettingsEditActions {...props} />} title= 
     {<SettingsTitle />} {...props}> 
     <SimpleForm toolbar={<EditToolbar />}> 
     <TextField source="description" /> 
     <DisabledInput elStyle={{ width: '100%' }} label="Default 
     value" source="defaultValue" /> 
     {renderCountryValue(props)} 
     </SimpleForm> 
    </Edit> 
); 
}; 




const renderCountryValue = (prop) => { 
    const record = prop.record; 
    if (record) { 
    if (record.multilang) { 
     // countryValue will be a dict with locale keys 
     // TODO Multilang fields temporary disabled in restClient 
     return null; 
    } 
    // countryValue will be single value or array 
    if (record.schema.type === 'array') { 
     // countryValue will be single array 
     if (record.schema.items.type === 'string') { 
     return <LongTextInput format={v => v.join()} parse={v => v.split(',')} label="Value" source="countryValue" />; 
     } 
     if (record.schema.items.type === 'integer') { 
     return <LongTextInput format={v => v.join()} parse={v => v.split(',')} validate={validateIntegerArray} label="Value" source="countryValue" />; 
     } 
    } 
    // countryValue will be single value 
    if (record.schema.type === 'string') { 
     return <TextInput label="Value" source="countryValue" />; 
    } 
    if (record.schema.type === 'integer') { 
     return <NumberInput label="Value" source="countryValue" />; 
    } 
    if (record.schema.type === 'boolean') { 
     return <BooleanInput label="Value" source="countryValue" />; 
    } 

    return <LongTextInput label="Value" source="countryValue" />; 
    } 
    return <TextInput label="Value" source="countryValue" />; 
}; 

이 작동되었다 : 나는 가게에서 기록을 연결하고이 코드를 사용하여이 작업을 수행하기 위해 관리되는 문자열, INT, 부울, 문자열의 배열, INT 등 : 까다로운 부분은 그 설정이 다른 유형을 가질 수 있었다 잘까지 1.3.1에 AOR를 그 후에 멈추는 그것을 시도했다 멈췄다. 내가 처음 발견 한 것은 렌더링이 없으므로 기본 TextInput을 렌더링하지만 두 번째 렌더링에서는이 입력을 NumberInput 등의 올바른 유형으로 렌더링하지 않는다는 것입니다. 나는 그것을 디버그하려고 시도했습니다. 다른 입력을 렌더링해야 할 때 배치하지만 화면에는 아무 것도 나타나지 않습니다. 아이디어 나 해결 방법이 있습니까?

답변

0

소품의 기록에 따라 몇 가지 문제가 발생했습니다. 그런 다음 대개 값에 대한 수동 검사를 설정하고 소품에 레코드가 없으면 null을 반환합니다.