Control diagram constraints and snapSettings programmatically

Hello,

I am trying to figure out how to change snapSettings and constraints programmatically on run time.
For example, I have a checkbox that when it is checked the gridlines are showen SnapConstraints.ShowLinen), and when not the gridlines are hidden (SnapConstraints.None)


Thanks,
Eden

1 Reply 1 reply marked as answer

AM Arunkumar Manoharan Syncfusion Team April 14, 2021 08:54 AM UTC

 
We have added a sample link to demonstrate how to show or hide the gridlines programmatically on run time. In the sample we have used checkbox while its checked gridlines will be shown and while its unchecked gridlines will be hided. Please refer to below code snippet and sample 

code snippet:
 
show() { 
    let lock = document.getElementById("lock"); 
    if (lock.checked) { 
      diagramInstance.snapSettings.constraints = SnapConstraints.All; 
    } else { 
      diagramInstance.snapSettings.constraints = SnapConstraints.None; 
    } 
    diagramInstance.dataBind(); 
  } 
 

Regards,
Arun


Marked as answer
Loader.
Up arrow icon