loading e-datamanager not attached to component

why is it that I can create a global datamanager and it will populate into the window.TablefeedbacksData 

<e-datamanager id="TablefeedbacksData" json="(IEnumerable<object>)ViewBag.TablefeedbacksDatasource"></e-datamanager>

BUT if I try and use a URL adaptor in the same manner. Not part of an  <ej-...> tag helper it won't work?

<e-datamanager id="urlData" url="http://localhost:60168/SyncFusion/ServerFeedbacksData?Id=kel" adaptor="UrlAdaptor" ></e-datamanager> 

1 Reply

IB Ilakkiya Baskar Syncfusion Team November 10, 2017 12:41 PM UTC

Hi  John friesen, 
Thank you for contacting Syncfusion Support.  
We suggest you to add the adaptor in Scripts section and that should be rendered after <ej-scriptmanager> in Layout page because this should be executed after the datamanger rendering. In the Script section, data is executed using   executeQuery method and loaded in the table during done callback function. 
We suggest you to get the data from the Data method which is placed in controller. Please refer the link below: 
 
@section Scripts{ 
    <script> 
         $(function () { 
 
            window.table1 = ej.DataManager({   // add adaptor 
                url: "Data", 
                crossDomain: true, 
                adaptor: new ej.UrlAdaptor() 
            }); 
            var query = ej.Query(); 
            window.table1.executeQuery(query).done(function (e) { // to load the data  
                $("#table1 tbody").html($("#tableTemplate").render(e.result)); 
            }); 
 
        }); 
Controller: 
// data to load 
public JsonResult Data(Syncfusion.JavaScript.DataManager dataObj) 
        { 
            List<Object> data = new List<object>(); 
            for (int i = 1; i <= 10; i++) 
            { 
                data.Add(new { OrderID = 10240 + i, CustomerID = "Customer" + i, EmployeeID = i }); 
            } 
            var records = data.Take(3); // take query of Data Manager 
            
            return Json(records); 
        } 
 
Please find the sample in the below location: 
 
Regards  
Ilakkiya.B 


Loader.
Up arrow icon