|
@Html.EJS().Schedule("schedule").Width("100%").CurrentView(Syncfusion.EJ2.Schedule.View.Agenda).SelectedDate(new DateTime(2018,08,20)).Height("550px").EventSettings(es => es.DataSource(dataManger =>
{ dataManger.Url("/Home/LoadData").CrudUrl("/Home/UpdateData").CrossDomain(true).Adaptor("UrlAdaptor");
})).EventRendered("onEventRendered").Render()
<script>
function onEventRendered(args) {
var scheduleObj = document.getElementById("schedule").ej2_instances[0];
if (scheduleObj.currentView == "Agenda") { // Here checking the view to apply the style only to the agenda view
if (args.data.Subject == "Pony Rides") {
args.element.firstChild.style.borderLeftColor = "#FFD700";
args.element.style.backgroundColor = "#6495ED";
}
if (args.data.Subject == "Birds of Prey") {
args.element.firstChild.style.borderLeftColor = "#800000";
args.element.style.backgroundColor = "#008B8B";
}
if (args.data.Subject == "Parrot Talk") {
args.element.firstChild.style.borderLeftColor = "#B22222";
args.element.style.backgroundColor = "#FF7F50";
}
if (args.data.Subject == "Camping with Turtles") {
args.element.firstChild.style.borderLeftColor = "#9932CC";
args.element.style.backgroundColor = "#DAA520";
}
if (args.data.Subject == "Venomous Snake Hunt") {
args.element.firstChild.style.borderLeftColor = "#4B0082";
args.element.style.backgroundColor = "#FF69B4";
}
}
}
</script> |
|
@{
List<string> view = new List<string>() { "Agenda" };
}
@(Html.EJ().Schedule("Schedule1")
.Width("750px")
.Height("525px")
.Views(view)
.CurrentView(CurrentView.Agenda)
.CurrentDate(new DateTime(2018, 6, 1))
.ShowAppointmentNavigator(false)
.AgendaViewSettings(agenda => agenda.DaysInAgenda(7))
.AppointmentSettings(fields => fields.Datasource(dataSource => dataSource.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor(AdaptorType.UrlAdaptor))
.ApplyTimeOffset(false)
.Id("Id")
.Subject("Subject")
.StartTime("StartTime")
.EndTime("EndTime")
.AllDay("AllDay")
.Recurrence("Recurrence")
.RecurrenceRule("RecurrenceRule"))
.ScheduleClientSideEvents(eve => eve.QueryCellInfo("onQueryCellInfo").Navigation("onNavigation"))
)
<script>
function onQueryCellInfo(args) {
if (this.model.currentView == "agenda") {
if (args.cellType == "agendaeventcell" && args.requestType == "agendacells") {
if (args.appointment.Subject == "Pony Rides") {
args.element[0].style.background = "#6495ED";
}
if (args.appointment.Subject == "Birds of Prey") {
args.element[0].style.background = "#008B8B";
}
if (args.appointment.Subject == "Parrot Talk") {
args.element[0].style.background = "#FF7F50";
}
if (args.appointment.Subject == "Camping with Turtles") {
args.element[0].style.background = "#DAA520";
}
if (args.appointment.Subject == "Venomous Snake Hunt") {
args.element[0].style.background = "#FF69B4";
}
}
}
}
</script> |
|
@{
List<string> view = new List<string>() { "Agenda" };
}
@(Html.EJ().Schedule("Schedule1")
.Width("750px")
.Height("525px")
.Views(view)
.CurrentView(CurrentView.Agenda)
.CurrentDate(new DateTime(2018, 6, 1))
.ShowAppointmentNavigator(false)
.AgendaViewSettings(agenda => agenda.DaysInAgenda(7))
.AppointmentSettings(fields => fields.Datasource(dataSource => dataSource.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor(AdaptorType.UrlAdaptor))
.ApplyTimeOffset(false)
.Id("Id")
.Subject("Subject")
.StartTime("StartTime")
.EndTime("EndTime")
.AllDay("AllDay")
.Recurrence("Recurrence")
.RecurrenceRule("RecurrenceRule"))
.ScheduleClientSideEvents(eve => eve.QueryCellInfo("onQueryCellInfo").Navigation("onNavigation"))
)
<script>
function onNavigation(args) {
if (args.currentView == "agenda") {
var newCurrentDate;
if (!ej.isNullOrUndefined(args.target)) {
if ($(args.target.target).hasClass("e-navigatenext")) { // The below code example will execute when navigating forward
newCurrentDate = new Date(args.previousDate.setDate(args.previousDate.getDate() + 7));
} else if ($(args.target.target).hasClass("e-navigateprevious")) { // The below code example will execute when navigating backward
newCurrentDate = new Date(args.previousDate.setDate(args.previousDate.getDate() - 7));
}
args.currentDate = newCurrentDate;
this.currentDate(args.currentDate); // Here setting the current date to take effect of the mentioned requirement
}
}
}
</script> |