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
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
Hi Edvin,
Thanks for using Syncfusion Products.
You can download the latest version 2014 Volume 4 Service Pack 2 from the following link.
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
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 support” is 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") |
@(Html.EJ().Grid<Order>("Editing") |
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
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,
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
...
.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