These are the issues faced while editing the recurring events:
function onDataBound() {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
var gridObj = document.querySelector('.e-grid').ej2_instances[0];
gridObj.dataSource = schObj.eventsData;
} |
@using Syncfusion.EJ2
@{
ViewData["Title"] = "Home Page";
}
<div style="display: flex">
<div>
<ejs-schedule id="schedule" width="100%" dataBound="onDataBound" selectedDate="new DateTime(2018, 2, 15)" height="650px">
<e-schedule-eventsettings dataSource="@ViewBag.appointments"></e-schedule-eventsettings>
</ejs-schedule>
</div>
<div>
<ejs-grid id="grid">
<e-grid-columns>
<e-grid-column field="Id" headerText="Identifiant"></e-grid-column>
<e-grid-column field="Subject" headerText="Subject"></e-grid-column>
<e-grid-column field="StartTime" headerText="StartTime"></e-grid-column>
<e-grid-column field="EndTime" headerText="EndTime"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
</div>
<script>
function onDataBound() {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
var gridObj = document.querySelector('.e-grid').ej2_instances[0];
gridObj.dataSource = schObj.eventsData;
}
</script> |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EJ2ScheduleSample.Models;
using EJ2ScheduleSample.Data;
using Newtonsoft.Json;
namespace EJ2ScheduleSample.Controllers
{
public class HomeController : Controller
{
private ScheduleDataContext _context;
public IActionResult Index()
{
ViewBag.appointments = GetScheduleData();
return View();
}
public class AppointmentData
{
public int Id { get; set; }
public string Subject { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}
public List<AppointmentData> GetScheduleData()
{
List<AppointmentData> appData = new List<AppointmentData>();
appData.Add(new AppointmentData
{
Id = 1,
Subject = "Explosion of Betelgeuse Star",
StartTime = new DateTime(2018, 2, 11, 9, 30, 0),
EndTime = new DateTime(2018, 2, 11, 11, 0, 0)
});
appData.Add(new AppointmentData
{
Id = 2,
Subject = "Thule Air Crash Report",
StartTime = new DateTime(2018, 2, 12, 12, 0, 0),
EndTime = new DateTime(2018, 2, 12, 14, 0, 0)
});
appData.Add(new AppointmentData
{
Id = 3,
Subject = "Blue Moon Eclipse",
StartTime = new DateTime(2018, 2, 13, 9, 30, 0),
EndTime = new DateTime(2018, 2, 13, 11, 0, 0)
});
appData.Add(new AppointmentData
{
Id = 4,
Subject = "Meteor Showers in 2018",
StartTime = new DateTime(2018, 2, 14, 13, 0, 0),
EndTime = new DateTime(2018, 2, 14, 14, 30, 0)
});
appData.Add(new AppointmentData
{
Id = 5,
Subject = "Milky Way as Melting pot",
StartTime = new DateTime(2018, 2, 15, 12, 0, 0),
EndTime = new DateTime(2018, 2, 15, 14, 0, 0)
});
return appData;
}
public IActionResult About()
{
ViewData["Message"] = "Your application description page.";
return View();
}
public IActionResult Contact()
{
ViewData["Message"] = "Your contact page.";
return View();
}
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
} |
Thank you for your response.
I have another issue. I have installed Syncfusion.EJ2.AspNet.Core 17.4.0.49 version in my application. I am using the following in Layout: <script src="https://cdn.syncfusion.com/ej2/dist/ej2.min.js"></script> and material.css.
The issue I am facing is my code runs as expected locally but when I run it on server I am unable to save the edited recurring event. This happens only when I edit recurring event. The error I found in the console are as follows:
SCRIPT5007: Unable to get property 'StartTime' of undefined or null reference
1. SCRIPT5007: SCRIPT5007: Unable to get property 'contains' of undefined or null reference
2. SCRIPT5007: SCRIPT5007: Unable to get property 'getTime' of undefined or null reference