glide-data-grid
glide-data-grid copied to clipboard
Number cell with BigInt support
The current version of the number cell only supports normal Numbers but not BigInt numbers (> 2^53). Two potential solutions would be to:
- Enable the native number-cell to handle
BigIntvalues in addition toNumbervalues. - Add a dedicate big-int cell to the
cellspackage.
I think option 1 is the way to go if react number format supports it. Have you a usecase for bigint data?
yeah, users have run into this a couple of times mostly related to columns that contain numerical IDs. And timestamps and time durations are sometimes represented in nanoseconds... which can easily overflow Number
It looks like to make this possible we would need to swap out the editor implementation. react-number-format does not support this.
I think react-number-format should be fine with handling larger numbers. E.g. 9007199254740992 is the highest supported value for Number without losing precision. In this demo, if you go higher the floatValue will lose precision but the string value will show the correct number:
https://github.com/glideapps/glide-data-grid/assets/2852129/5c33642e-e1d8-43d2-853a-9cebaadefabc
This means, that we would need to handle the value as a string for the react-number-format input field if the cell data is a bigint.
Oh very nice. Okay Im on board with this.