How to avoid circular grid structure

Hello,

I ran into issue where i wanna JSON.stringify grid object but i get circular structure when it is in edit mode (see picture).  Is there a way to avoid that circularity ? Cause i need to stringify object and then convert it back and get the same functionality with edit and etc.



1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team June 5, 2018 01:41 PM UTC

Hi Domantas, 

Thanks for using Syncfusion products. 

We have maintained the parent element in columns edit property to access some properties. For your scenario, we can stringify the grid instance by removing the columns edit property like as follows, 
[btnClick] 
btnClick(args:any){ 
       
      let gridObj = extend({}, this.Grid); //clone the Grid instance; 
      for(let i=0;i<gridObj.columnModel.length; i++){ 
         
        delete gridObj.columnModel[i].edit //remove the edit property in Grid 
         
     
      //here we can stringify the grid instance 
      console.log(JSON.stringify(gridObj.columnModel);) 
   

We have also prepared a sample for your convenience which can be referred from following link, 
Please let us know if you have any further assistance on this. 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon