|
Client Side:
var dataManager = ej.DataManager({
url: "/Home/GetData", // used to load data initially
crudUrl: "/Home/Batch", // used to add / update / delete appointment
adaptor: new ej.UrlAdaptor()
});
$("#Schedule1").ejSchedule({
appointmentSettings: {
dataSource: dataManager
}
}); |
|
Server Side:
public JsonResult GetData() // initially this function returns appointments to load it in schedule
{
IEnumerable data = db.ScheduleDatas.Take(100);
return Json(data, JsonRequestBehavior.AllowGet);
}
public JsonResult Batch(EditParams param)
{
if (param.action == "insert" || (param.action == "batch" && param.added != null))
{
// this block of code will execute while inserting the appointments
}
if ((param.action == "remove") || (param.action == "batch" && param.deleted != null))
{
// this block of code will execute while removing the appointment
}
if (param.action == "update" || (param.action == "batch" && param.changed != null))
{
// this block of code will execute while updating the appointment
}
IEnumerable data = new DataClasses1DataContext().ScheduleDatas.Take(500);
return Json(data, JsonRequestBehavior.AllowGet);
} |