CurrentDate loading schedule
Hi support, i'm using the schedule control with UrlAdaptor.
This is the schedule
$(function () {
var dataManager = ej.DataManager({
url: "/Waitingroom/Schedulings/ScheduleAppointments",
updateUrl: "/Waitingroom/Schedulings/UpdateScheduling",
adaptor: new ej.UrlAdaptor()
});
$("#schedule").ejSchedule({
currentDate: new Date(),
firstDayOfWeek: "Monday",
currentView: "day",
locale: 'it-IT',
appointmentSettings: {
dataSource: dataManager
}
});
});
Showing the parameter passed with Firefox debugger and Chrome debugger, the CurrentDate parameter is not correct. If i don't use UrlAdaptor (and i use the WebApiAdaptor) tha CurrentDate is correct. Why ?
I need to use the UrlAdaptor and not WebApiAdaptor
The currentData is a Zulu Time but it's possible to send the data in GMT format like the GET with webapiadaptor ?
Thanks in advance
Stefano Capobianco
SIGN IN To post a reply.
5 Replies
VS
Velmurugan S
Syncfusion Team
May 2, 2018 12:54 PM UTC
Hi Stefano,
Thanks for Contacting Syncfusion support.
We have analyzed the mentioned scenario and would like to inform you that the reason for the reported problem is due to the default conversion (arguments with “JSON.stringify”) of the date value taking place internally in our source while making the request (getting schedule record) due to the usage of JSON.stringify. Therefore, We suggest you to use the custom adaptor to solve the issue. Extend the UrlAdaptor and override the processQuery method to convert the date as string and then pass it to the UrlAdaptor’s processQuery method. Refer to the following code.
|
var customAdaptor = new ej.UrlAdaptor().extend({
processQuery: function (dm, query, hierarchyFilters) {
for (var i = 0; i < query._params.length; i++) {
var keys = Object.keys(query._params[i]);
for (var j = 0; j< keys.length; j++){
if(query._params[i][keys[j]] instanceof Date ) query._params[i][keys[j]] = query._params[i][keys[j]].toString();
}
}
return ej.UrlAdaptor.prototype.processQuery(dm, query, hierarchyFilters);
},
});
var dataManager1 = ej.DataManager({
url: '@Url.Action("GetData","Home")',
adaptor: new customAdaptor()
}); |
Regards,
Velmurugan
SC
Stefano Capobianco
May 7, 2018 04:51 PM UTC
Hi Velmurugan your solution work very well. Now my problem is the return from the ASP.Net Core MVC Controller. The data are correct inside the controller but when i try to see the response in firefox developer the payload is empty. After 1 mins the response id done but the paylod is not correctly formatted. The error is SyntaxError: JSON.parse unterminated string at line 1 column 1048577 of the JSON data for a transfer of 860MB.
The result set come directly from ef core and when i use the include statement ( i have 4 relationship ) the problem appear. Inside the startup class i use this option for the mvc service:
services.AddMvc()
.AddXmlSerializerFormatters()
.AddJsonOptions(optionsJson =>
{
optionsJson.SerializerSettings.ContractResolver = null;
optionsJson.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
})
.AddViewLocalization()
.AddDataAnnotationsLocalization()
.AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining<Startup>());
Where i'm wrong ?
Thanks in advance
Stefano Capobianco
VS
Velmurugan S
Syncfusion Team
May 16, 2018 02:56 PM UTC
Hi Stefano,
We tried to trace the error which you are facing but since it is working fine at our end with your same startup configuration, could you please share in which format you are receiving the payload in firefox either it has been replaced with “\” or some other characters in between. Also, could you please confirm either you have used any other dynamic JSON conversion module in your application. We have prepared the sample with your given code example (control rendering code with start up code) in this incident along with our previous suggestion (using custom adaptor) given in our last update, which can be downloaded from the following location.
Please find the Firefox developer payload details:
Kindly try with the above sample and suggestion and if you still face the same issue at your end, kindly revert back to us with our above requested details along with your control rendering code (if differs from the shared code) , and the network request details checked in the Firefox developer tools. The information provided by you will be more helpful for us to analyze your mentioned scenario further and proceed to give you the better solution.
Regards,
Velmurugan
SC
Stefano Capobianco
May 18, 2018 04:32 AM UTC
Hi Velmurugan, thanks for your response, i've solved my problem switching to Odata Adapter. it's work very well the only problem is that: for the asp.net core (my server component) the odata stack is in beta and i hope was release the final version fast.
Thanks
Stefano
VS
Velmurugan S
Syncfusion Team
May 21, 2018 10:26 AM UTC
Hi Stefano,
Thanks for your update.
Please let us know if you need any further assistance on this.
Regards,
Velmurugan
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
SC Stefano Capobianco
- Apr 30, 2018 06:37 AM UTC
- May 21, 2018 10:26 AM UTC