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'm using useListDrawer with enableRowSelections={true} in a custom field component for a relationship field. When I select multiple items by checking their checkboxes and then close/reopen the drawer, the checkboxes appear unchecked even though my state maintains the selected IDs correctly. The drawer seems to reset its internal selection state every time it opens/closes.
What I'm trying to do
Create a custom relationship field that allows users to select multiple items
Display checkboxes for bulk selection
Persist the selections when the drawer is closed and reopened
Have the checkboxes remain checked based on previously selected items
Question
Is there a prop or method to pass pre-selected IDs to the ListDrawer component so that checkboxes appear checked based on stored selection data? I've checked ListDrawerProps and don't see any prop like selectedIds, defaultSelectedIds, or preSelectedIds.
Is this a known limitation, or is there a recommended approach for handling persistent checkbox selections in ListDrawer?
Environment
Payload CMS v3
Using useListDrawer hook with custom field component
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
I'm using
useListDrawer
withenableRowSelections={true}
in a custom field component for a relationship field. When I select multiple items by checking their checkboxes and then close/reopen the drawer, the checkboxes appear unchecked even though my state maintains the selected IDs correctly. The drawer seems to reset its internal selection state every time it opens/closes.What I'm trying to do
Question
Is there a prop or method to pass pre-selected IDs to the
ListDrawer
component so that checkboxes appear checked based on stored selection data? I've checkedListDrawerProps
and don't see any prop likeselectedIds
,defaultSelectedIds
, orpreSelectedIds
.Is this a known limitation, or is there a recommended approach for handling persistent checkbox selections in ListDrawer?
Environment
Beta Was this translation helpful? Give feedback.
All reactions