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

"Maximum call stack size exceeded" when you add data source to TreeView

Hi,

I get the "Maximum call stack size exceeded" error when I set add data source to the TreeView.

Attached example contains 2 buttons "Add valid DS" and "Add invalid DS".
Both data sources have the same structure except the second one (invalid DS) has more elements.

Valid DS works normally, but Invalid DS causes the error.
Invalid DS does not contain too many items, 38, I do not know why is this ?


Regards,
Milos

Attachment: DurandalSyncfusionStarterKit_d67c711b.zip

5 Replies

AB Ashokkumar Balasubramanian Syncfusion Team April 7, 2017 10:56 AM UTC

Hi Milos  
   
We have analyzed the reported issue (“Maximum call stack size exceeded”). An issue occurs due to bind the same id for more than one node elements in treeview datasource.so please provide the different ids for each element to resolved your problem  
    
[Script]   
   
 {   
     "id": "3a4a446a-efa3-e511-80f5-00155d10662b",//should specify different id value for eachNode   
     "name": "Test (Beispiel)",   
     "expanded": true,   
     "pid": "1659b326-dd65-5d95-a131-1aa8a643ede1",   
  },   
   
Regards,   
Ashokkumar B.  


MI Milos April 7, 2017 11:22 AM UTC

Hi Ashokkumar,

Thank you for your quick response.
The error is not descriptive at all.
In this case where I have few elements, it is possible to find the error.
In case that I have a million elements it is impossible.

I think that that kind of error should not crash the diagram or at least we should get more descriptive error how I can easily find problematic node.

regards,
Milos


AB Ashokkumar Balasubramanian Syncfusion Team April 10, 2017 11:41 AM UTC

Hi Milos, 
 
Thanks for your reply. 
 
We are unable to handle the datasource related validation process in TreeView component, because it is not formal one. Please use the below code block to validate the datasource before bind it into treeview component. 
 
[Scripts] 
 
var ids = []; 
var collection = []; 
 
$.each(invalidDataSource, function(index, value) { 
       if($.inArray(value.id, ids) == -1) //check if id value not exits in other objects than add it 
       { 
            ids.push(value.id); 
            collection.push(value); 
       } 
}); 
 
 
Regards, 
Ashokkumar B. 



MI Milos April 10, 2017 12:49 PM UTC

Hi Ashokkumar,

Thank you.
Custom method for datasource validation can help here.
I do not have further questions regarding this issue.

Regards,
Milos


AB Ashokkumar Balasubramanian Syncfusion Team April 11, 2017 06:44 AM UTC

Hi Milos, 
 
Okay, Most Welcome. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon