No appointment appear after load on demand

Hi, 

I am using asp mvc core 2. I am having an issue changing the source of the the data from a model to a remote source. I can see the return of data within the developers console, and can confirm that the result contains data but still nothing appears in the schedule. Any advice would be amazing

         I have the following view
                    <ej-schedule id="Schedule1" appointment-template-id="#apptemplate" orientation="Vertical" resource-header-template-id="#resTemplate" width="100%" height="525px" current-date="new DateTime(2016, 11, 7)" date-format="dd/MM/yyyy" locale="en-GB" before-appointment-create="onAppointmentSave" before-appointment-change="onAppointmentEdit" before-appointment-remove="onAppointmentDelete" drag-stop="onDragStop" current-view="Workweek" start-hour="9" end-hour="18" show-weekend="false" enable-load-on-demand="true">
                        <e-blockout-settings datasource="Model.BlockedAppointments" subject="Subject"  start-time="StartTime" end-time="EndTime" resource-id="ResourceId" is-all-day="IsAllDay" is-block-appointment="IsBlackAppolintment" enable="true"></e-blockout-settings>
                        <e-time-scale enable="true" major-slot="30" minor-slot-count="1"></e-time-scale>
                        <e-resources >
                            <e-resource field="OwnerId" title="Owner" name="Owners" allow-multiple="false">
                                <e-resource-settings datasource="Model.Resources" text="Text" id="SIP3ResourceId" color="Color" group-id="GroupId">
                                </e-resource-settings>
                            </e-resource>
                        </e-resources>
                        <e-group resources="Model.Group"></e-group>
                        <e-categorize-settings enable="true"></e-categorize-settings>
                        <e-priority-settings enable="true"></e-priority-settings>
                        <e-appointment-settings  id="SIP3AppointmentId" subject='"Subject"' start-time='"StartTime"' start-time-zone='"StartTimeZone"' end-time='"EndTime"' end-time-zone='"EndTimeZone"' description='"Description"' location='"Location"' all-day='"AllDay"' priority='"Priority"' categorize='"Categorize"' recurrence='"Recurrence"' recurrence-rule='"RecurrenceRule"' recurrence-id="RecurrenceId" recurrence-ex-date="RecurrenceExDate" resource-fields='"OwnerId"'>
                            <e-datamanager url="/SIP3/GetData" cross-domain="false" headers='new List<Dictionary<string, object>> { new Dictionary<string, object>() { { "contactId", ViewBag.contactId } } }'></e-datamanager>
                        </e-appointment-settings>
                    </ej-schedule>

i have the following action


       public IEnumerable<Appointment> GetData(String CurrentDate, String CurrentView, String CurrentAction, string contactId)
        {
            var route = Request.Headers["contactId"].ToString();

            var id = int.Parse(route);

            var id = 1;

            var trimmedDate = CurrentDate.Replace(" 0100 (GMT Summer Time)", "");

            DateTime dt = DateTime.ParseExact(trimmedDate, "ddd MMM dd yyyy HH:mm:ss 'GMT'K", CultureInfo.InvariantCulture);

            var cDate = dt;
            var sDate = new DateTime();
            var eDate = new DateTime();


            //swtich statement to query view type
            //calulate start/end date depending on view
            switch (CurrentView)
            {
                case "workweek":
                    sDate = cDate.FirstDayOfWeek();
                    eDate = cDate.LastDayWorkWeek();
                    break;
                case "day":
                    sDate = cDate;
                    eDate = cDate;
                    break;
                case "week":
                    sDate = cDate.FirstDayOfWeek();
                    eDate = cDate.LastDayOfWeek();
                    break;
                case "month":
                    sDate = cDate.FirstDayOfMonth();
                    eDate = cDate.LastDayOfMonth();
                    break;

                default:
                    break;
            }

            //build appointments
            var appoint = _context.SIP3Appointment
                .Where(x => x.ContactId == id)
                .Where(x => x.StartTime >= sDate && x.StartTime <= eDate)
                .ProjectTo<Appointment>()
                .ToList();


            return  appoint;
        }


The data returned to the view is

[
{ "siP3AppointmentId": 2, "contactId": 1, "subject": "test 21", "startTime": "2016-11-09T10:30:00", "endTime": "2016-11-09T11:00:00", "ownerId": "1", "allDay": false, "recurrence": false } ]

7 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team February 15, 2018 05:45 PM UTC

Hi Alex, 

Thank you for contacting Syncfusion support. 

We suspect that appointment fields are not mapped correctly which could be the cause for the issue. In the provided data collection, starting letter of appointment fields (ex startTime) are in small letters but in e-appointment-settings it is mapped as StartTime. We have prepared the sample for your reference and kindly ensure it at your end. 
 
DB image: 
 
 
Console image: 
 

Regards, 
Karthigeyan 



AP Alex Power February 20, 2018 08:15 AM UTC

Hi, thanks for the replay

Your demo project worked perfectly, however i have been unable to implement a working version.

The data is being passed from the action to the schedule however the appointment is still not rendered on the screen.

We have json settings in our project that force camel case and cannot be changed at the minute.

So i changed the data binding to point at "startTime" etc.

i have the following data loaded in the schedule




AP Alex Power February 21, 2018 10:34 AM UTC

Could you also advise if it is possible to load the blocked resource on demand the same as you would an appointment.

I currently have the following  schedule view. When the appointments load the packet body has additional information such as the action/view/date. When the same time is requested for the blocked resources there is no additional information sent with the request.


  <ej-schedule id="Schedule1"
                                 width="100%"
                                 height="525px"
                                 enable-load-on-demand="true"
                                 current-date="DateTime.Now"
                                 drag-stop="onDragStop"
                                 resize-stop="onResizeStop"
                                 start-hour="9"
                                 end-hour="18"
                                 show-weekend="false"
                                 allow-drag-and-drop="false"
                                 enable-appointment-resize="false">
                        <e-time-scale enable="true" 
                                      major-slot="60" 
                                      minor-slot-count="1"></e-time-scale>
                        <e-group resources="@ViewBag.Grouping"></e-group>
                        <e-resources>
                            <e-resource field="OwnerId" title="Owner" name="Owners" allow-multiple=true>
                                <e-resource-settings datasource="@ViewBag.OwnerData"
                                                     text="Text" id="SIP3ResourceId"
                                                     group-id="GroupId" color="Color">
                                </e-resource-settings>
                            </e-resource>
                        </e-resources>

                        <e-appointment-settings apply-time-offset="false"
                                                id="SIP3AppointmentId"
                                                subject='"Subject"'
                                                start-time='"StartTime"'
                                                end-time='"EndTime"'
                                                all-day='"AllDay"'
                                                recurrence='"Recurrence"'
                                                recurrence-rule='"RecurrenceRule"'
                                                resource-fields='"OwnerId"'>

                            <e-datamanager url="/SIP3/GetData"
                                           insert-url="/SIP3/Save"
                                           batch-url="/SIP3/ProcessBatch"
                                           remove-url="/SIP3/Delete"
                                           adaptor="UrlAdaptor"
                                           headers='new List<Dictionary<string, object>> { new Dictionary<string, object>() { { "contactId", ViewBag.contactId } } }'></e-datamanager>
                        </e-appointment-settings>


                        <e-blockout-settings enable="true"
                                             id="Id"
                                             subject="Subject"
                                             start-time="StartTime"
                                             end-time="EndTime"
                                             resource-id="OwnerId"
                                             is-block-appointment="IsBlockAppointment">
                            <e-datamanager url="/SIP3/GetBlockedData"
                                           adaptor="UrlAdaptor"
                                           headers='new List<Dictionary<string, object>> { new Dictionary<string, object>() { { "contactId", ViewBag.contactId } } }'></e-datamanager>

                        </e-blockout-settings>


                    </ej-schedule>


NR Nevitha Ravi Syncfusion Team February 21, 2018 05:29 PM UTC

Hi Alex, 

Thanks for your update. 

We suspect that there might be mismatch in type of ‘ownerId’ field which could cause the reported problem. Kindly check whether you have used same type in DB and dataSource of resource as shown below.  


 
 

Kindly check the above case and if the issue persists still share your resource details or try to reproduce it in previous sample and revert us to proceed further. 

Currently there is no load on demand support for block out settings. 

Regards, 
Nevitha. 



MW Mariusz Wojewoda July 25, 2018 01:48 PM UTC

Hi, I've got the same problem. 

This is my scheduler :
 <ej-schedule id="@("sched"+i.ToString())" width="100%" height="565px" locale="pl-PL" views="Model.Views" current-view="Month" enable-load-on-demand="true"
                     current-date="@ViewBag.DomyslnaData" show-quick-window="false" show-location-field="false" show-appointment-navigator="false">
            <e-group resources="@ViewBag.Grouping"></e-group>
            <e-time-scale enable="false"></e-time-scale> 
            <e-resources>
                <e-resource field="UserId" title="Pracownik" name="Pracownicy" allow-multiple="false">
                    <e-resource-settings text="Nazwa" id="Id" group-id="GroupId" color="Color">
                        <e-datamanager url="/KAL/Home/GetPrac?id=@i" adaptor="UrlAdaptor"></e-datamanager>
                    </e-resource-settings>
                </e-resource>
            </e-resources>
            <e-categorize-settings enable="false" datasource="@Model.Kategorie" allow-multiple="false" id="KategoriaId" color="Color" font-color="FontColor" text="Text"></e-categorize-settings>
            <e-priority-settings enable="false"></e-priority-settings>
            <e-appointment-settings id="WpisId" subject='"Temat"' start-time='"DataOd"' end-time='"DataDo"' description='"Opis"' all-day='"CalyDzien"' categorize='"KategoriaId"'  resource-fields='"UserId"' recurrence='"Recurrence"' recurrence-rule='"RecurrenceRule"'>
                <e-datamanager url="/KAL/Home/GetData?id=@i" crud-url="/KAL/Home/Batch?id=@i" adaptor="UrlAdaptor"></e-datamanager>
            </e-appointment-settings>
        </ej-schedule>   

This is my class :
  public class DefaultSchedule
        {
            public int WpisId { get; set; }
            public string Temat { get; set; }
            public bool CalyDzien { get; set; }
            public DateTime DataOd { get; set; }
            public DateTime DataDo { get; set; }
            public string UserId { get; set; }
            public string Opis { get; set; }
            public string KategoriaId { get; set; }
            public bool Recurrence { get; set; }
            public string RecurrenceRule { get; set; }
            public string RoomId { get; set; }
        }

And my Get functions :
private List<DefaultSchedule> ListaWpisow (DateTime data, int id)
        {
            var _prac = _pracownicy.Single(p => p.Id == id).Pracownicy.Select(p => p.Id).ToList();
            var dataret = _context.Wpis.Where(p => p.DataOd.Date >= Pomoce.PierwszyDzienMiesiaca(data) && p.DataDo.Date <= Pomoce.OstatniDzienMiesiaca(data)
            && _prac.Contains(p.UserId)).Select(p => new DefaultSchedule { CalyDzien = p.CalyDzien, DataDo = p.DataDo, DataOd = p.DataOd, KategoriaId = p.KategoriaId.ToString(), Opis = p.Opis, Temat = p.Temat, UserId = p.UserId, WpisId = p.WpisId, RoomId = "1" }).ToList();
            return dataret;
        }
        public JsonResult GetPrac(int id)
        {

            var data = _pracownicy.Single(p => p.Id == id).Pracownicy;
            return Json(data);
        }
        public BatchDataResult GetData([FromBody] MyPostModel post, int id)
        {
            var data = ListaWpisow(post.CurrentDate, id);

            BatchDataResult result = new BatchDataResult();
            result.result = data;
            result.count = data.Count()>0 ? data.Count() : 1;
            return result;
        }
My result is :
  1. {result: [,…], count: 5}
    1. count:5
    2. result:[,…]
      1. 0:{WpisId: 12, Temat: "dfsdf", CalyDzien: true, DataOd: "09-07-2018 22:00", DataDo: "10-07-2018 21:59",…}
        1. CalyDzien:true
        2. DataDo:"10-07-2018 21:59"
        3. DataOd:"09-07-2018 22:00"
        4. KategoriaId:"2"
        5. Opis:"sdfsdfsdf"
        6. Recurrence:false
        7. RecurrenceRule:null
        8. RoomId:"1"
        9. Temat:"dfsdf"
        10. UserId:"00ac2c73-2faa-4c83-83a5-7bf84b59f753"
        11. WpisId:12
I have also batch funcion. Adding works, data is saved to database but cant display it on scheduler. Can you help me please ? 


MW Mariusz Wojewoda July 26, 2018 09:03 AM UTC

I've found the problem :
In startup.cs i have serializer option :
options.SerializerSettings.DateFormatString = "dd-MM-yyyy HH:mm";

When removed, everything works.


VS Velmurugan S Syncfusion Team July 26, 2018 11:25 AM UTC

Hi Alex, 

Thanks for your update. 

We are glad that the reported issue resolved by yourself. Please let us know if you need any further assistance on this. 

Regards, 
Velmurugan

Loader.
Up arrow icon