Hello Karthigeyan,
Based on the value of 'Soort' I want to change the background color of the appointment in a cell.
Having a hard time to understand how to bind that to CatogorizeSettings, hope you can help me.
Best regards,
Stephen
@(Html.EJ().Schedule("Schedule1")
.Width("100%")
.Height("500px")
.CellWidth("50px")
.CellHeight("80px")
.TimeZone("UTC +00:00")
.CurrentDate(new DateTime(2016, 1,1))
.ShowAllDayRow(false)
.ShowQuickWindow(false)
.Orientation(Orientation.Horizontal)
.Locale("nl-NL")
.CurrentView(CurrentView.Month)
.CategorizeSettings(fields => fields.Datasource((IEnumerable<Categorize>)ViewBag.catagorize).AllowMultiple(true).Id("Soort").Text("text").Color("color").FontColor("fontColor"))
.Resources(res =>
{
res.Field("PersoonId").Title("Persoon").Name("persoonSource").AllowMultiple(true)
.ResourceSettings(flds => flds.Datasource((IEnumerable<Persoon>)ViewBag.persoonSource).Text("Naam").Id("PersoonId")).Add();
})
.Group(gr =>{gr.Resources(ViewBag.Resources); })
.AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/DienstRooster/GetData").CrudURL("/DienstRooster/Batch").Adaptor("UrlAdaptor"))
.Id("RoosterId")
.Description("Opmerking")
.Subject("Onderwerp")
.StartTime("Start")
.EndTime("Eind")
.AllDay("IsAllDay")
.Recurrence("IsRecurrence")
.RecurrenceRule("RecurrenceRule")
.ResourceFields("PersoonId"))
.ScheduleClientSideEvents(eve => eve.AppointmentWindowOpen("onAppointmentWindowOpen"))
)
Controller:
public ActionResult Rooster()
{
var PersoonSource = new BsContext().Persoon.ToList();
ViewBag.persoonSource = PersoonSource;
List<Categorize> CategorizeValue = new List<Categorize>();
CategorizeValue.Add(new Categorize { text = "Blue Category", Soort = 0, color = "#43b496", fontColor = "#ffffff" });
CategorizeValue.Add(new Categorize { text = "Green Category", Soort = 100, color = "#7f993e", fontColor = "#ffffff" });
CategorizeValue.Add(new Categorize { text = "Orange Category", Soort = 200, color = "#cc8638", fontColor = "#ffffff" });
List<String> resources = new List<String>();
resources.Add("persoonSource");
ViewBag.Resources = resources;
ViewBag.categorize = CategorizeValue;
return View();
}
public class Categorize
{
public string text { set; get; }
public int Soort { set; get; }
public string fontColor { set; get; }
public string color { set; get; }
}
public class Rooster
{
public int RoosterId { get; set; }
public int PersoonId { get; set; }
public DateTime Start { get; set; }
public DateTime Eind { get; set; }
public int Soort { get; set; }
-------
}