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.
Unfortunately, activation email could not send to your email. Please try again.

Data Manager combining URL and JSON data

Thread ID:

Created:

Updated:

Platform:

Replies:

124574 Jun 15,2016 04:12 AM Jun 16,2016 07:58 AM JavaScript 1
loading
Tags: ejGrid
duncan
Asked On June 15, 2016 04:12 AM

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

Karthick Kuppusamy [Syncfusion]
Replied On June 16, 2016 07:58 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;