marmelab / react-admin

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
25.07k stars 5.27k forks source link

No data shown in DataGrid in ReferenceManyField #3916

Closed zhouhao27 closed 5 years ago

zhouhao27 commented 5 years ago

What you were expecting:

My article has multiple comments which identified by article_id.

article

Screenshot 2019-11-01 at 3 36 30 PM

Comments

Screenshot 2019-11-01 at 3 36 19 PM

What happened instead:

No records shown for comments.

Steps to reproduce:

Related code:

Code in my PhotoEdit:

         <ReferenceManyField
        reference="comments"
        label="Comments"
        target="article_id"
        fullWidth
      >
        <Datagrid>
          <TextField source="body" />
        </Datagrid>
      </ReferenceManyField>

My CodeSandbox link.

Other information:

User name: demo@mail.com Password: password

Environment

djhi commented 5 years ago

Hi, and thanks for your question. As explained in the react-admin contributing guide, the right place to ask a "How To" question, get usage advice, or troubleshoot your own code, is StackOverFlow.

This makes your question easy to find by the core team, and the developer community. Unlike Github, StackOverFlow has great SEO, gamification, voting, and reputation. That's why we chose it, and decided to keep GitHub issues only for bugs and feature requests.

So I'm closing this issue, and inviting you to ask your question at:

http://stackoverflow.com/questions/tagged/react-admin

And once you get a response, please continue to hang out on the react-admin channel in StackOverflow. That way, you can help newcomers and share your expertise!

zhouhao27 commented 5 years ago

Sorry. But I thought this is a bug. No data shown in DataGrid.

djhi commented 5 years ago

It's not. This is a feature used in all our examples, which work, so there is something wrong with your code and StackOverflow is where you should ask for help.

gabrielperales commented 5 years ago

@zhouhao27 Did you manage to make it work? I'm having the same problem but I don't know if it's my fault or if it is a bug

gabrielperales commented 5 years ago

Ok, It was my fault. The problem was that there was not a resource in the Admin component for the resource we are making reference in ReferenceManyField. Read more https://github.com/marmelab/react-admin/issues/1903#issuecomment-396900348

Cornul11 commented 3 years ago

@zhouhao27, probably not actual anymore, but for those finding this in the future, usually this problem occurs when you didn't define a proper resource in the <Admin> component. So, in order to fix your problem @zhouhao27, you'd have to have something along these lines:

<Admin ...>
    <Resource ...> // other resources
    <Resource name="comments">
</Admin>
ayushsingh2204 commented 3 years ago

for active filters in simple grid , a default message come "No results found" when list returns empty . Its not reading empty prop ?