Skip to content

editSelectOptions values and labels #1069

Answered by sgjohnston
sgjohnston asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up solving this by essentially re-implementing packages/material-react-table/src/components/inputs/MRT_EditCellTextField.tsx to change the initialisation of the selector. I changed line 44 from
const [value, setValue] = useState(() => cell.getValue<string>());
to
const [value, setValue] = React.useState(row.original[column.id]);
This is the only change required, it could be great if there was a column option to allow this rather than re-implmenting the whole component.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sgjohnston
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant