revolist / revogrid

Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
https://rv-grid.com
MIT License
2.73k stars 171 forks source link

Numeric type value is converting to string #485

Open majkelwork opened 1 month ago

majkelwork commented 1 month ago

Check if issue exists Not exists, in revogrid version 2 is working

Describe the issue I am using column numeral plugin and my data contains numbers with column type 'numeric'. When I edit a row in the datagrid, the value type is changing from number to string

To Reproduce Codesandbox

revolist commented 1 month ago

Hi @majkelwork ,

Thank you for reporting this issue. We've investigated the problem and found that it’s related to how the numeric column type is currently implemented.

Issue Description

In the Revogrid version you're using, when editing a cell in a column with the type 'numeric', the value type changes from a number to a string. This is due to the editor component using HTMLInputElement.value, which captures the input as a string.

Findings

Solution

To properly handle numeric values, we recommend manually parsing the input value to convert it to a number with beforeedit event.

Future Plans

We plan to improve this by automatically applying parseFloat for numeric inputs in future updates which would require use to create separate editor for number components. However, this feature is not currently prioritized, so for now, handling the conversion manually is the best approach.

Summary

We appreciate your understanding and patience. If you have any more questions or need further assistance, please let us know!

Best regards,
Revolist Team

majkelwork commented 1 month ago

@revolist What is then the point of using columnTypes? BeforeEdit is not a workaround, because the grid will still store data as string instead of number. Grid recognizes that an edit occurred when the change from number to string occurred. It causes excessive triggering of afterEdit, and I am not able to decide if the row was edited or only clicked. The biggest bug occurs when the number is 0, because then it is removed and replaced with an empty string after click on cell editor.

m2a2x commented 1 month ago

Hello @majkelwork I just fixed 0 case scenario for you, it's much bigger issue