Open sydneyjodon-wk opened 1 month ago
Hey @sydneyjodon-wk ... is there a specific reason why you need to keep the column type as 'singleSelect'
... it works perfectly fine when you set it to 'string'
But yes, I do agree that the valueOptions
property should not be optional.
I'll mark this as a bug and add it to the board for the team to discuss.
Yep! I know it works fine as string, I'm just worried about our consumers doing something similar and using 'singleSelect'
without valueOptions
assuming that it works and then having it throw unexpectedly. Thanks for updating that!
The problem in depth
Hello 👋
My team has a
singleSelect
column type that we overrode the edit cell for to make it multi-select and therefore didn't setvalueOptions
because we no longer needed it. This has seemed to work fine, but we just ran into an error being thrown when trying to export to excel:Click the "download as excel" option to repro in this Codesandbox: https://codesandbox.io/p/sandbox/datagrid-singleselect-without-valueoptions-hydgjz?file=%2Fsrc%2FDemo.tsx
If I add a
valueOptions
, it works again!I understand that my usage could probably qualify more as a
type: 'string'
column, butvalueOptions
is marked as optional and it seemed to work without setting it until I ran into this error. So my question is: Is this particular case an issue with the download to excel or isvalueOptions
actually required onsingleSelect
columns? If it is the later, would it be possible to change the type definition to reflect that it is required to avoid this type of thing where things are assumed to work without it, but then some case comes up where it throws. Or maybe there's some other issue that I'm missing that's causing this?Thank you!
Your environment
See codesandbox: https://codesandbox.io/p/sandbox/datagrid-singleselect-without-valueoptions-hydgjz?file=%2Fsrc%2FDemo.tsx
Search keywords: valueOptions required singleSelect Order ID: 82849