Calcs not calcing, reading data as string incorrectly

Posted by: curiosichi on 27 September 2022, 3:53 pm EST

    • Post Options:
    • Link

    Posted 27 September 2022, 3:53 pm EST - Updated 3 October 2022, 2:41 am EST

    https://stackblitz.com/edit/angular-kywafl?file=src/app/app.component.ts

    I have included an example of an issue identified when our team upgraded our wijmo recently after a two year license lapse. The code example above used to function as expected before an Angular 10->13 upgrade and Wijmo library upgrade.

    The issue:

    When importing a flexsheet object via JSON from our api, even when data is forced entered as a numeric type, a calc function calcs one time on load, but subsequent user entered data is ignored. My assumption is because the type is actually a string once the grid loads.

    I included some additional data to show some of the reasons that we need to import data via JSON in this way to dynamically format the grid ect, but the problem we are trying to solve specifically needs to take JSON object parsed like this and allow our custom calcs and wijmo built in calcs (like SUM) to work when the user enters data on the grid.

    Thanks!

  • Posted 29 September 2022, 5:35 pm EST

    Hi,

    Sorry for the delayed response, the observed behavior occurred because the first item object of the data source used in the FlexSheet has string type value which makes the column dataType to string.

    To resolve the issue you need to explicitly set the column dataType to Number. You can handle the loadedRows event of the FlexSheet and update the columns dataType. Please refer to the sample link below demonstrating the same:

    https://stackblitz.com/edit/angular-ja69xd?file=src%2Fapp%2Fapp.component.ts

    Regards

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels