You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Show component for a 'Parent' resource and I want to import a CSV which contains entries of a 'Child' resource. Now I need to reference the currently displayed Parent ID in a field for every imported Child.
I understand that I can add static information in the transformRows callback but how can I possibly inject the currently displayed Parent record into the function?
Thank you in advance for any solution or hint in the right direction!
constconfiguration: ImportConfig={// ...transformRows: (csvRows)=>{letrows=[];csvRows.map((row)=>{row.parent_id=parent.id;// this is where I need the injected datarows.push(row);});returnrows;},// ...}exportconstParentShow=(props)=>(<Show{...props}><TabbedShowLayout><Tablabel="Parent Details"><TextFieldsource="parentdetail1"/><TextFieldsource="parentdetail2"/></Tab><Tablabel="Children"path="children"><ImportButton{...props}{...configuration}/><ReferenceManyFieldreference="children"target="parent_id"><Datagrid><TextFieldsource="childdetail"/></Datagrid></ReferenceManyField></Tab></TabbedShowLayout></Show>);
The text was updated successfully, but these errors were encountered:
Hi there!
I have a Show component for a 'Parent' resource and I want to import a CSV which contains entries of a 'Child' resource. Now I need to reference the currently displayed Parent ID in a field for every imported Child.
I understand that I can add static information in the transformRows callback but how can I possibly inject the currently displayed Parent record into the function?
Thank you in advance for any solution or hint in the right direction!
The text was updated successfully, but these errors were encountered: