react-admin: Provided selectedIds to Datagrid do not the pre check the checkboxes

What you were expecting: I expected an array of selectedIds provided as a prop to Datagrid to cause the checkboxes to be initially checked at the records with an id included in that list of selectedIds.

What happened instead: The checkboxes are not checked.

Steps to reproduce: Provide a selectedIds prop with an array of id’s to a Datagrid.

Related code: https://codesandbox.io/s/xr8z4jvr5q

<Datagrid selectedIds={[13, 12]}>
  ....
</Datagrid>

image

Environment

  • React-admin version: 2.0.4
  • Last version that did not exhibit the issue (if applicable): n/a
  • React version: 16.3.1
  • Browser: any
  • Stack trace (in case of a JS error): n/a

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (18 by maintainers)

Most upvoted comments

Until now I have managed to cross rivers without much knowledge of sagas and generator functions. When high tides arrive and I need to cross, I’ll make sure to acquire it. Thanks for your help today! It was really valuable to me.

Interesting use-case. Indeed, the selectedIds is managed entirely through the redux state so you won’t be able to override it this way. Give me some time to verify how you could that.