We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Diagram saving method (saveDiagram ) not working when i'm adding second layer

hello

I'm using Angular diagram and when I'm adding second layer on run time ( exactly like example on documentation) and then I'm trying to save with saveDiagram method but there is errorerror on saving.PNG

there is no problem when diagram have only one layer

this first layer

  public layers: LayerModel[] = [
    {
      id: 'customLayer1',
      visible: true,
      lock: false,
      addInfo: {
        describtion: 'default layer',
        order:-1
      }
    }
  ];


and this is how im adding layer

  addLayer() {
    let newLayer: LayerModel = {
      objects:[],
      id: `customLayer${(this.diagram?.layers.length || 0) + 1}`,
      visible: true,
      lock: false,
      addInfo: {
        describtion: '',
        order : '-1'        
      },
      zIndex:-1
    }
    this.diagram?.addLayer(newLayer, []);
   
    this.diagram?.setActiveLayer(newLayer.id || '');
    this.getCtrl('id').setValue(newLayer.id);
    this.selectedLayer.setValue(newLayer.id);
   
  }


and then im adding node from the pallet , all my nodes are native

if i add node to diagram.layers[0] there is no problem

but when im using this code 

    this.diagram?.setActiveLayer(customLayer2);

then draging node from pallet , and now  saveDiagram  is not working any more.

Note: ​version of diagram "@syncfusion/ej2-angular-diagrams": "^20.4.42",

Note : ​in both layeres i have only Native nodes.


2 Replies

LM Liam Mir January 22, 2023 10:06 AM UTC

hi 

I have solved problem


[serializationSettings]="serializationSettings"


problem was above line

I delete this and problem solved

here is stackblitz sample

https://stackblitz.com/edit/angular-cpr7be-fomezw?file=app.component.ts



BM Balasubramanian Manikandan Syncfusion Team January 23, 2023 03:02 PM UTC

Please contact us if you need further assistance.


Loader.
Live Chat Icon For mobile
Up arrow icon