Coder Social home page Coder Social logo

ReferenceManyField about aor-graphql HOT 5 CLOSED

marmelab avatar marmelab commented on May 2, 2024
ReferenceManyField

from aor-graphql.

Comments (5)

humbertocruz avatar humbertocruz commented on May 2, 2024 1

Hello, well I found that the problem it's with the relation field. When I create a relation between types on graphcool it names then by the related type without the _id sufix. That would be changed in the schema. But the value of this relational fields are a object with a id and the type related.

from aor-graphql.

philipheinser avatar philipheinser commented on May 2, 2024

@humbertocruz What is your solution to that? I have the same problem. If target was allowed to be a function we could return a array of ids for that field.

from aor-graphql.

vysakh0 avatar vysakh0 commented on May 2, 2024

@humbertocruz @philipheinser Can you please share if you had fixed this?

export const UserShow = (props) => (
    <Show {...props}>
        <SimpleShowLayout>
            <TextField source="name" />
            <TextField source="phone" />
            <ReferenceManyField label="Replies" addLabel={false}  reference="Reply" target="user.id">
                <Datagrid>
                    <TextField source="text" />
                </Datagrid>
            </ReferenceManyField>
        </SimpleShowLayout>
    </Show>
);

screen shot 2018-03-06 at 6 02 18 pm

screen shot 2018-03-06 at 6 02 27 pm

I'm getting this error!

from aor-graphql.

humbertocruz avatar humbertocruz commented on May 2, 2024

sorry, I didn't find a solution and change my App to use PouchDB.

from aor-graphql.

vysakh0 avatar vysakh0 commented on May 2, 2024

@humbertocruz oh okay, thank you 👍 I have found a solution.

For those who have the problem.

export const UserShow = (props) => (
    <Show {...props}>
        <SimpleShowLayout>
            <TextField source="name" />
            <TextField source="phone" />
            <ReferenceManyField label="Replies" addLabel={false}  reference="Reply" target="user">
                <Datagrid>
                    <TextField source="text" />
                </Datagrid>
            </ReferenceManyField>
        </SimpleShowLayout>
    </Show>
);
  1. Make sure you define the Resource that you're trying to access under <Admin> component whether you're going to use it or not. In my case Reply is not required to appear in menu, but if I want it to use it as aReference field, I have to define it as a Resource

from aor-graphql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.