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

Data Manager combining URL and JSON data

Its unclear from the documentation how to achieve this. I am trying to improve the efficiency of my grid by adding the initial data to my page model and using that for the initial bind. Subsequently I want to update the grid via ajax. I am clear on the ajax setup for the Data Manager.

How can I give it my initial data AND an Insert URL AND an Update URL like the following pseudo code?

   var dataManager = new ej.DataManager({
                DATA: MYINITIALDATA,
                updateUrl: stringFormat("{0}enquiry/Update", self.baseuri),
                insertUrl: stringFormat("{0}enquiry/Insert?Id={1}&enquiryId={2}",
                    self.baseuri,
                    routingId,
                    self.enquiryId),
                adaptor: new self.adaptor()
            });


Regards,

Duncan

3 Replies

KK Karthick Kuppusamy Syncfusion Team June 16, 2016 11:58 AM UTC

Hi Duncan, 

Thanks for contacting Syncfusion support. 

We have analyzed your code snippet and we suggest to use the URL  Adaptor for your requirement.URL Adaptor of DataManager can be used when you want to use remote service to retrieve data. It interacts with server-side for all DataManager Queries and CRUD operations.We can bind the data for the grid in initial bind using url and and also can update the grid using updateUrl .Refer the code example. 



JS 

$("#Grid").ejGrid({ 
        dataSource: ej.DataManager({ url: "/Home/DataSource", updateUrl: "/Home/Update", insertUrl: "/Home/Insert",      removeUrl: "/Home/Delete", adaptor: "UrlAdaptor" }), 
        allowPaging: true, 

Controller 

public ActionResult Update(EditableOrder value) 
        { 
            OrderRepository.Update(value); 
            var data = OrderRepository.GetAllRecords(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 
         
        public ActionResult Insert(EditableOrder value) 
        { 
            OrderRepository.Add(value); 
            var data = OrderRepository.GetAllRecords(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 


Please refer the following KB Link. 

UG Link. 


Regards, 
K.Karthick. 



'W 'wale December 11, 2018 02:47 PM UTC

Hello, how can i set the UrlAdaptor links from a javascript function for ejs


TS Thavasianand Sankaranarayanan Syncfusion Team December 12, 2018 07:29 AM UTC

Hi Wale, 

We have already discuss about your mentioned query “How to use UrlAdaptor in ejs Grid“ in the following documentation. 


Regards, 
Thavasianand S.  


Loader.
Live Chat Icon For mobile
Up arrow icon