Row create partial default #1165
sdriffill-tm
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Sure. PR? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Background
I'm using Material React Table to create an editable grid with creating row functionality. I want to populate only a subset of the columns on my new blanks rows with a default value, in my case a column called
online
which holds aboolean
, like so:Problem
I'm getting a type error on this line:
createRow(table, { online: true })
.Whilst the second param to
createRow
is optional, if provided it must satisfy my specificMRT_RowData
type for the table, so any props marked as required must be in the default data.Solution
Can we wrap the type of this param in a
Partial
to let you provide default values for only a subset of columns? I'm getting no errors in the actual running instance of the component despite the TS warning so have had to add a// @ts-expect-error
in the mean time.Beta Was this translation helpful? Give feedback.
All reactions