Refresh Content (Maximum call Stack Exceeded)

Hi. 

I have a treegrid that i am needing to perfrom refreshes with. 

I have looked at different ways to perform this method, however each time i come accross the same issue of Maximum call stack size exceeded. 



I am using the same method to retrieve the datasource for the update as when i am initally rendering the treegrid, and on initial load, the datasource is accepted. (Using MVC)



Below i have attached a copy of the Javascript i use to try and obtain the datasource for update. 


Any Help would be appricated, 

Thanks Paul Lees 


1 Reply

JR John Rajaram Syncfusion Team May 16, 2018 01:01 PM UTC

Hi Paul, 
 
Thank you for contacting Syncfusion support. 
 
We suggest you to use setModel method for resetting the data source in TreeGrid control. Please refer the following code snippets for more details. 
 
Code snippets: 
[Index.cshtml] 
//... 
 
<body> 
    <button id="changeDT">Change Datasource</button> 
    @(Html.EJ().TreeGrid("container") 
             .ChildMapping("subtasks") 
             //... 
 
                              .Datasource(ViewBag.datasource) 
    )@(Html.EJ().ScriptManager()) 
 
    <script>         
        $("#changeDT").click(function () { 
            var dataManager = ej.DataManager({ url: "Home/DataValue", adaptor: new ej.UrlAdaptor() }); 
            var promise = dataManager.executeQuery(new ej.Query()); 
            promise.done(function (e) { 
                $("#container").data("ejTreeGrid").setModel({ dataSource: e.result });                 
            });             
        }); 
    </script> 
</body> 
 
 
[HomeController.cs] 

//... 
    public class HomeController : Controller 
    { 
        //... 
        public JsonResult DataValue() 
        { 
            sample s1 = new sample(); 
            var obj = s1.GetData1(); //New datasource value  
            return Json(obj, JsonRequestBehavior.AllowGet);              
        } 
         
//... 

 
We have also prepared the sample with the above code snippets. Please find the sample from the following location. 
Sample Location:  
Let us know if you need further assistance on this. 
 
Regards, 
John R 


Loader.
Up arrow icon