0
特別なURLに私に戻りますSaveButtonを作成するにはどうすればよい:私はこのようなSaveButtonのためにリダイレクトパラメータとしてURLを使用することができることを知って
const ResourcePropertyEditToolbar = props => <Toolbar {...props} >
<SaveButton />
<SaveButton label="save and resource" redirect={"/resource/21"}
submitOnEnter={false} raised={false} />
</Toolbar>;
ご覧のように、「/リソース/ 21 "ハードコーディングされています(このエントリのために;-)どうすれば動的にURLを作成できますか?値自体は、このように、編集された現在のデータセットに含まれる:
export const ResourcePropertyEdit = (props) => (
<Edit {...props} >
<SimpleForm toolbar={<ResourcePropertyEditToolbar />}>
<NumberInput source="position" defaultValue="1"/>
<TextInput source="property_name" validate={required}/>
<ReferenceInput label="Resource" source="fk_resource"
reference="resource">
<AutocompleteInput optionText="shortname"/>
</ReferenceInput>
</SimpleForm>
</Edit>
);
それは選択fk_resourceの値です。
ReferenceManyField Entryを持つ基本フォームのコードスニペットは、resource_propertyを編集した後でこのビューに戻ることです。
export const ResourceEdit = (props) => (
<Edit {...props}>
<SimpleForm>
<TextInput source="shortname" validate={required}/>
<ReferenceManyField target="fk_resource"
reference="resource_property" >
<Datagrid>
<NumberField source="position"/>
<TextField source="property_name"/>
<ReferenceField label="Property" source="fk_property" reference="property" allowEmpty>
<TextField source="shortname"/>
</ReferenceField>
<EditButton/>
</Datagrid>
</ReferenceManyField>
</SimpleForm>
</Edit>
);
現在のデータセットがAOR内のレコードと呼ばれている任意のヘルプ
おかげでそれにアクセスすることができますが、私は「未定義のプロパティを読み取ることができません 『URL』を」受け取る私の小道具を点検し、私は{「無効」を持っている:偽、「submitonenterを」 :true}。 – Steffen
あなたのレコードにURLが入っていますか? –
上記を変更して、これが機能するかどうかを確認してください。ページ間を移動するときにAORがどのように動作するかについては、私も少しはわかりません。 –