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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Does DataManager now support OData

Thread ID:

Created:

Updated:

Platform:

Replies:

121364 Jan 18,2015 05:20 PM UTC Oct 13,2016 11:55 AM UTC ASP.NET Web Forms 16
loading
Tags: Schedule
Garwin Pryce
Asked On January 18, 2015 05:20 PM UTC

Hello, 

I saw this post about OData V4 : http://www.syncfusion.com/forums/117024/does-datamanager-support-odata-v4

It was sometime ago, so I am wondering if DataManager now supports OData V4 Protocol. Secondarly, Does it support Lightswitch's OData  protocol (what every version it is). 

Thank you.

God Bless!


Alan Sangeeth S [Syncfusion]
Replied On January 19, 2015 02:09 PM UTC

Hi Garwin,

Thanks for using Syncfusion Products.

Query 1: “OData V4 Protocol support in DataManager”

We are sorry for the inconvenience caused. The in-built support for OData V4 protocol in DataManager will be included in 2014 Volume 4 Service Pack release which is expected to be rolled out at the end of January 2015.

Query 2: “Lightswitch's OData  protocol in DataManager”

Yes DataManager supports Lightswitch's OData protocol. We can give the Lightswitch application odata service url to DataManager “url” property to achieve you requirement. Please refer the following code snippets.

itemTemplate.ejGrid(

            {

                dataSource:ej.DataManager("http://localhost:5268/LightSwitch/ApplicationData.svc/EmployeeInfo")

...

})

Please let us know if you need any further assistance.

Regards,
Alan Sangeeth S



Garwin Pryce
Replied On January 19, 2015 03:28 PM UTC

OKay, that is cool. 

Thanks. 

God Bless!

Alan Sangeeth S [Syncfusion]
Replied On January 20, 2015 12:57 PM UTC

Hi Garwin,

Thanks for the update.

As promised the in-built support for OData V4 protocol in DataManager will be included in 2014 Volume 4 Service Pack release.

We appreciate your patience until then.

Regards,
Alan Sangeeth S



Edvin
Replied On March 16, 2015 03:02 PM UTC

Hi Alan.

Is service pack for 2014 volume 4 released yet ?
As i can see on my dashboard there is only version from 24. dec. avaliabe 

Do you have release date for 2015 volume 1 ?

Thanks for advance.

Edvin


Alan Sangeeth S [Syncfusion]
Replied On March 17, 2015 10:51 AM UTC

Hi Edvin,

Thanks for using Syncfusion Products.

You can download the latest version 2014 Volume 4 Service Pack 2 from the following link.

http://www.syncfusion.com/forums/118366/essential-studio-2014-volume-4-service-pack-2-release-v12-4-0-34-available-for-download

And the upcoming release Volume 1, 2015 is scheduled to be rolled out at the March 2015.

Also we are sorry to let you know that due to some complexity we missed to include the in-built support for Odata V4 Protocol in DataManager and it will be included in 2015 Volume 1 Service Pack release which is expected to be rolled out at the end of April 2015.

Until then we suggest you to use the following workaround in which we have used custom adaptor by extending default ej.ODataAdaptor to support Odata V4.

We can extend the ej.OdataAdaptor as follows.

var ODataV4Adaptor = new ej.ODataAdaptor().extend({

options: {

count: "$count",

search: "$search"

},

onCount: function (e) {

return e === true ? "true" : "";

},

beforeSend function will be trigger the event before every server request.

beforeSend: function (dm, request, settings) { //Will be triggered before every request to server.

// some services do not support custom header on crossDomain (CORS) request

if (!dm.dataSource.crossDomain) {

request.setRequestHeader("DataServiceVersion", "4.0");

request.setRequestHeader("MaxDataServiceVersion", "4.0");

}

},

processResponse is used to process the response to the server

processResponse: function (data, ds, query, xhr, request) { //used to process the response from server

var count;

if (query && query._requiresCount) {

count = data['@odata.count'];

data = data.value;

}

return ej.isNullOrUndefined(count) ? data : { result: data, count: count };

},

In the grid load event, we can assign the custom adaptor to the grid datamanager as follow.

@(Html.EJ().Grid<Order>("Editing")

.Datasource(ds => { ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders/").CrossDomain(true); })//"http://services.odata.org/V4/Northwind/Northwind.svc/Orders/")

.ClientSideEvents(eve => eve.Load("load").ActionComplete("CompleteHandler").ActionBegin("BeginHandler"))

)

</div>

<script>

refContent = false;

function load(args) {

args.model.dataSource.adaptor = new ODataV4Adaptor;

}

</script>

Sample: http://www.syncfusion.com/downloads/support/forum/117993/EJGrid-1931126555.zip a

Thanks for your patience.

Please let us know if you have any queries.

Regards,
Alan Sangeeth S


Alan Sangeeth S [Syncfusion]
Replied On May 4, 2015 12:23 PM UTC

Hi Edvin,

We are glad to announce that our Essential Studio 2015 Volume 1 Service Pack Release v13.1.0.26 is rolled out and is available for download under the following link:


http://www.syncfusion.com/forums/118977/essential-studio-2015-volume-1-service-pack-release-v13-1-0-26-available-for-download

The fix for the issue Odata V4 supportis included in the above provided link.

We have created a new adaptor “OdataV4Adaptor” to support Odata V4 and we suggest you to use the “OdataV4Adaptor” adaptor to resolve the issue with OData V4. Please refer the following code snippets.

@(Html.EJ().Grid<Order>("Editing")
.Datasource(ds => { ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders/").AdaptorType(AdaptorType.ODataV4Adaptor).CrossDomain(true); })

)



We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Alan Sangeeth S

Fane O'Callaghan
Replied On May 6, 2015 09:42 AM UTC

Note that in Alan's example above it should say .Adaptor instead of .AdaptorType

.Datasource(ds => { ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders/").AdaptorType  <-- Here should be .Adaptor



Ragavee U S [Syncfusion]
Replied On May 7, 2015 06:56 AM UTC

Hi Fane,

We regret for the inconvenience caused.

By mistake, we have updated the code snippet wrongly. Please find the correct snippets below.


@(Html.EJ().Grid<Order>("Editing")
.Datasource(ds => { ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders/").Adaptor(AdaptorType.ODataV4Adaptor).CrossDomain(true); })

)



Regards
Ragavee U S

Jimmy Toenners
Replied On May 14, 2015 07:36 AM UTC

Trying to use the ODataV4Adaptor in javascript - no success with $batch yet - can you please provide us with a sample of this working with ASP.NET ODataV4 

Alan Sangeeth S [Syncfusion]
Replied On May 18, 2015 05:27 AM UTC

Hi Jimmy,

We are sorry for the inconvenience caused.

We considered this query “Batch Editing issue with OData V4” as a bug and a support incident has been created under your account to track the status of this issue. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please get back to us if you need any further assistance.

Regards,
Alan Sangeeth S

desfero
Replied On September 7, 2015 02:43 PM UTC

Hello, how can i turn my DataManager to use Odata V4?
I use typescript in my application and have following code 

 this.proManager = new ej.DataManager({ url: "http://localhost:63599/odata/Pro/"});

Best regards 

Saravanan Arunachalam [Syncfusion]
Replied On September 8, 2015 09:02 AM UTC

Hi Desfro

We suggest to use ODataV4Adaptor to retrieve the data from the Odata V4 services. Please refer the following documentation link to use the datamanager with Odata V4 services.

UG Link: http://docs.syncfusion.com/js/datamanager/data-binding#odata-v4 

We have an issue with “ODataV4Adaptor not included in typescript” and we have fixed that issue internally.

And this fix will be included in the Volume 2, 2015 Service Pack 2 release which will be expected to be rolled out by the end of this week.

Regards,

Saravanan.A


Shenglin Guo
Replied On December 2, 2015 08:44 PM UTC

Hi Jimmy,

We are sorry for the inconvenience caused.

We considered this query “Batch Editing issue with OData V4” as a bug and a support incident has been created under your account to track the status of this issue. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please get back to us if you need any further assistance.

Regards,
Alan Sangeeth S

Hi,

Just wondering if the batch update ($batch) issue has been resolved in the latest release. I am trying to use the scheduler component and when using the extended edit screen, the component will issue a batch update. I am trying to make it work with a asp.net WebAPI odata v4 end point. So far no success. Can you perhaps provide an working example of how to configure the DataManager and / or the webapi to make this work?

Thanks

Shenglin Guo
Replied On December 2, 2015 09:38 PM UTC

Hi,


I have done some further investigation since the post and found that the batch command issued by DataManager need a couple slight modification to make it work. I have tested using Fiddler to successfully send a batch request to my asp.net webapi service. Please advise where I configured the data manager wrong, or a work around to this issue.



var dataManager = ej.DataManager({

            //OData v4 service

            url: "http://localhost:27725/api/odata/shifts",           

            adaptor: new ej.ODataV4Adaptor(),

            crossDomain: true,

            batch : false

        });


 this.$().ejSchedule({

            ...

            enableLoadOnDemand: true,

            appointmentSettings: {

                // Configure the dataSource with dataManager object

                dataSource: dataManager

            }

        });


Request issued by DataManager when doing batch post


POST http://localhost:27725/api/odata/shifts/$batch HTTP/1.1

Host: localhost:27725

Connection: keep-alive

Content-Length: 793

Accept: */*

Origin: http://localhost:4200

X-FirePHP-Version: 0.0.6

User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36

Content-Type: multipart/mixed; charset=UTF-8;boundary=batch_d2043d72-35c1-4a2c-a068-ed4329d9d03a

Referer: http://localhost:4200/

Accept-Encoding: gzip, deflate

Accept-Language: en-NZ,en;q=0.8,en-AU;q=0.6,en-US;q=0.4,zh-CN;q=0.2,zh;q=0.2,zh-TW;q=0.2


--batch_d2043d72-35c1-4a2c-a068-ed4329d9d03a

Content-Type: multipart/mixed; boundary=changeset_f9b6ca9b-01ae-4b58-845c-9b8d04989fe8


--changeset_f9b6ca9b-01ae-4b58-845c-9b8d04989fe8

Content-Type: application/http

Content-Transfer-Encoding: binary 


POST undefined HTTP/1.1

Accept: application/json;odata=light;q=1,application/json;odata=verbose;q=0.5

Content-Id: 0

Content-Type: application/json; charset=utf-8 


{"Subject":"test","Id":3,"StartTimeZone":"UTC +12:00","EndTimeZone":"UTC +12:00","AllDay":false,"Recurrence":false,"Description":"","StartTime":"2015-12-03T02:30:00.000Z","EndTime":"2015-12-03T03:00:00.000Z","Guid":"57fa65b2-76b0-3b9a-d8d3-ed0f32185788","AppTaskId":3,"ParentId":3}


--changeset_f9b6ca9b-01ae-4b58-845c-9b8d04989fe8--

--batch_d2043d72-35c1-4a2c-a068-ed4329d9d03a--


Please note the highlighted bits above, the batch update address should be


http://localhost:27725/api/odata/$batch 


and the bit where it says undefined, should be 

http://localhost:27725/api/odata/shifts

OR

shifts



Then it works, hope this will help you understand my problem. I am new to Syncfusion and have never used Syncfusion before so I might be making really obvious silly mistake here, please help me out. 


Since this is a new project I am working on, I do not have to use oData service, I just thought it is the preferred data service by Syncfusion, please advise if otherwise. I am happy to provide more information if required.


Regards


Ranjithkumar Jeyakodi [Syncfusion]
Replied On December 8, 2015 01:29 PM UTC

Hi Shenglin,

Thanks for contacting Syncfusion support.

We have analyzed your mentioned scenario and we suspect that the reason for the issue is the ODataV4Adaptor. Therefore, we request you to use the ODataV4Adaptor while using version 4 based adaptor, otherwise use the ODataAdaptor to overcome the above mentioned issue. We suggest you to refer the our  below documentation link to know more about OdataV4.

http://help.syncfusion.com/js/datamanager/data-binding#odata-v4


Please let us know if you need any further assistance.

Regards,
Ranjithkumar

Fermin
Replied On October 13, 2016 11:55 AM UTC

Here my solution
I am using Schedule in MVC, here the partial code for the Datasource settings for OData V4 endpoint made in MS WebApi OData
...
        .EnableLoadOnDemand(true)
         .AppointmentSettings(fields => fields.Datasource(
             ds => ds.URL("https://myserver/leads/api/odata/LeadsCitas")
             .BatchURL("https://myserver/leads/api/odata/$batch")
         .Adaptor(AdaptorType.ODataV4Adaptor)
...

My solution is editing ej.web.all.min.js it is best no unminify for edit.

uglifyjs ej.web.all.min.js --beautify --output ej.web.all.js

Then edit line 1811, function    batchRequest, original code is commented // :

batchRequest: function(n, i, r) {
            var e = r.guid = t.getGuid(a.batchPre), 
            //o = n.dataSource.url.replace(/\/*$/, "/" + this.options.batch), 
            o = n.dataSource.batchUrl,//Using batchUrl instead
            f = {
                //url: r.url //Here r.url is undefined
                url: n.dataSource.url.substr(n.dataSource.url.lastIndexOf('/') + 1) , //Get the las element of url for the correct url 
                key: r.key,
                cid: 1,
                cSet: t.getGuid(a.changeSet)
            }, u = "--" + e + "\n";

Rest of code stay the same, this code work fine for me.

After testing you can minify, remember to backup

uglifyjs ej.web.all.js --output ej.web.all.min.js

Note uglifyjs can is a node.js program

npm install -g uglify-js







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.

Warning Icon 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.Close Icon

;