Error on trying to Save/Load a Diagram

Hi

I'm trying to save and load a Diagram but I got some javascript errors on load a right after the Diagram be serialized. If I get diagram data from online demo it works but not my.

This is my load code:
<code>
        try {
           var diagramData = "... my saved diagram data string";
            console.log('1: string');
            this.diagramObj.loadDiagram(diagramData);
            console.log('2: string');
        } catch (e) {
            console.log(e.message);
            console.log(JSON.stringify(e));
            try {
                console.log('2: json');
                var json = JSON.parse(diagramData);
                console.log('3: json');
                this.diagramObj.loadDiagram(json);
                console.log('4: json');
            } catch (e) {
                console.log(e.message);
                console.log(JSON.stringify(e));
            }
        }
</code>

I attached my saved diagram.

Thank you.

Attachment: saveData_21995077.zip

4 Replies

SG Shyam G Syncfusion Team March 11, 2020 06:09 AM UTC

Hi Gerson, 

Reported issue: Exception raised while loading a JSON data in loadDiagram method 

We can reproduce the issue. We have confirmed this as a defect. We have logged a defect report for this issue. We will fix this issue and provide the patch on volume 1, release which is scheduled to release by the end of March, 2020.      

You can track the status of the issue from the below feedback link. 


As a workaround, we have loaded your json data using loadDiagram method. Please refer to a code example and the sample below. 

Code example: 
function loadDiagram(event) { 
var saveDiagram=yourjson; 
if(saveDiagram.nodes.length > 0) { 
                     for(var i=0; i < saveDiagram.nodes.length; i++) { 
                         var node = saveDiagram.nodes[i]; 
                         //initialize ports 
                         node.ports = []; 
                    
                
                 saveDiagram.width="1000px"; 
                 saveDiagram.height = "1000px"; 
                diagram.loadDiagram(JSON.stringify(saveDiagram)); 



Regards, 
Shyam G 



GC Gerson C Teixeira March 17, 2020 01:06 PM UTC

Hi.

Thank you, the workaround solve my problem.


SG Shyam G Syncfusion Team March 18, 2020 04:36 AM UTC

Hi Gerson, 

Thanks for your update. 

As promised, we will provide the patch for the reported issue on volume 1,2020 release which is scheduled to release by the end of March, 2020. 

Regards, 
Shyam G 



AR Aravind Ravi Syncfusion Team April 2, 2020 01:34 PM UTC

Hi Gerson, 
 
The reported issue Exception raised while loading a JSON data in loadDiagram method has been fixed and included in volume 1, 2020 release (v18-1-0-42) which is rolled out and available for download under the following link. 
 
 
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards 
Aravind Ravi 
 


Loader.
Up arrow icon