spread.toJSON() is not working after upgrading 12.0.0

Posted by: arnoldbendaa on 18 September 2019, 9:50 pm EST

  • Posted 18 September 2019, 9:50 pm EST

    Hello.

    I have upgraded the spreadjs from 11.0.0 to 12.0.0.

     
    var spread = new GC.Spread.Sheets.Workbook(document.getElementById('spreadsheet'));
    var data = JSON.parse(jsonForm);
     spread.fromJSON(data.spread);
                    var data = {
                        spread: spread.toJSON()
                    };
    
    

    when I call the function spread.toJSON(), I get such error.

    TypeError: this.MOa is not a function

    at ma.onProtectChanged (gc.spread.sheets.charts.12.0.0.min.js:50)

    at Function.a.ao (gc.spread.sheets.all.12.0.0.min.js:25)

    at ma.Op (gc.spread.sheets.all.12.0.0.min.js:28)

    at gc.spread.sheets.all.12.0.0.min.js:28

    at Object.set [as isProtected] (gc.spread.sheets.all.12.0.0.min.js:24)

    at Boolean. (gc.spread.sheets.all.12.0.0.min.js:29)

    at b.H (gc.spread.sheets.all.12.0.0.min.js:13)

    at ma.T3 (gc.spread.sheets.all.12.0.0.min.js:29)

    at ma.vs (gc.spread.sheets.all.12.0.0.min.js:29)

    at ma.ad (gc.spread.sheets.all.12.0.0.min.js:29)



    How can I fix this error?

    Please help me.

    Thanks.

  • Posted 19 September 2019, 4:57 am EST

    Hi Arnold,

    Could you please also share the JSON file you are trying to open and export so that we could further investigate the issue

    Regards

    Sharad

  • Posted 19 September 2019, 8:09 pm EST

    Thank you for reply.

    I share the json file json.txt.

    you can see the jsonForm in the text file.

    I have tried the jsonForm.

    Please help me.

    Thank you.

    json.zip

  • Posted 20 September 2019, 1:23 am EST

    Thank you sharing the JSON file. However, we are sorry but we are unable to replicate the issue at our end the attached file. Following are the steps we followed in order to try to replicate the issue:

    • Load the attached json.txt file into the following sample:

    https://codesandbox.io/s/spread-js-starter-zev0n

    • Click on ‘log result from toJSON’ button to log the result of toJSON() call on console

    : Spread gets successfully serialized to JSON.

    Please have a look at the above sample and let us know if we are missing something in order to replicate the issue.

    Please feel free to modify the sample so that it replicates the issue.

  • Posted 20 September 2019, 3:33 am EST

    Thank you.

    I just add 2 libraries.





    it is not working now.

  • Posted 23 September 2019, 5:12 am EST

    In the shared snippet, the migration file is added before the chart plugin and then the issue is arising, please make sure that the migration file is added after all of the other spread scripts files and that should fix the issue.

    Please let us know if the issue persists for you.

Need extra support?

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

Learn More

Forum Channels