We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

31 days in May


Hello,

@{ViewBag.Title = "ScheduleFeatures";}

<script src="@Url.Content("~/Scripts/ej/cultures/ej.culture.nl-NL.min.js")"></script>
 
<h2>31 days in May??</h2>
 
@(Html.EJ().Schedule("Schedule1")
 .Width("100%")
 .Height("500px")
 .CellWidth("40px")
 .CellHeight("80px")
 .TimeZone("UTC +00:00")
 .CurrentDate(new DateTime(2016, 5, 1))
 .ShowAllDayRow(false)
 .ShowQuickWindow(false)
 .Orientation(Orientation.Horizontal)
 .Locale("nl-NL")                                                              //<== Remove for 31 days or change year 2015 or 2017
 .CurrentView(CurrentView.Month)
 .AppointmentSettings(fields => fields.Datasource(Model)
 .Id("Id")
 .Subject("Subject")
 .StartTime("StartTime")
 .EndTime("EndTime")
 .AllDay("AllDay")
 .Recurrence("Recurrence")
 .RecurrenceRule("RecurrenceRule"))
 .StartHour(0)
 .EndHour(12)
 .AppointmentTemplateId("#MyTemplate")
)

1) Adopted your SceduleFeatures sample.
When using .Locale("nl-NL") th month May only gives 29 days

2) Is it possible to change the background color of  appointment(s) in a cell.

Best regards,

Stephen




5 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team May 2, 2016 02:48 PM UTC

Hi Stephen, 
Thank you for contacting Syncfusion support. 
Please find the following responses for your queries. 
Query1: When using .Locale("nl-NL") month May only gives 29 days 
We have updated the information regarding this query in the incident 156260. Please have a follow up with that incident. 
Query2: Is it possible to change the background color of  appointment(s) in a cell? 
You can change the appointment color by one of the following way. 
1.       Categorize option allows you to categorize the color of the appointment. 
2.       Template option allows you to customize the appointment display. 

Regards,
Karthigeyan  
 



SS Stephen Schlette May 3, 2016 03:54 PM UTC


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; }
-------
}


KK Karthigeyan Krishnamurthi Syncfusion Team May 4, 2016 06:54 AM UTC

Hi Stephen,   
   
Thanks for your update.   
   
We have prepared a sample for your requirement “Need to use categorize option” which can be download from the following location:   
 
In the above sample we have changed the appointment color based on the categorize id (Soort) value. Kindly follow the below steps to apply categorize colors to appointment.   
 
1.     Add one column to hold the categorize id values for the appointment in the data base as shown below.   
 
 
 
2.     Map the category field names to the corresponding category field in the view page as shown below.   
<Code> 
.CategorizeSettings(fields => fields.Datasource(ViewBag.categorize).Enable(true).AllowMultiple(true).Id("Soort").Text("text").Color("color").FontColor("fontColor")) 
</Code> 
 
3.     Bind the category field to an AppointmentSettings to apply colors for an appointment as shown below.   
<Code> 
   .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Home/GetData").CrudURL("/Home/Batch").Adaptor("UrlAdaptor")) 
               .Id("Id") 
                -------- 
                -------- 
                .Categorize("CategoryId") 
                .Recurrence("Recurrence") 
            .RecurrenceRule("RecurrenceRule")) 
</Code>  
 
To know more about the categorize option, kindly refer the below link.   
   
Regards,   
Karthigeyan   
 



SS Stephen Schlette May 4, 2016 10:32 AM UTC

Thanks I understand it better now.
Thought that .CategorizeSettings .Id("Soort") would bind it  to the
field "Soort" in the appointment record. Did not realize it had to
be a string. Solved it by having my model returning
a CatergoryId string from my Soort field

Best regards,

Stephen


KK Karthigeyan Krishnamurthi Syncfusion Team May 5, 2016 04:16 AM UTC

Hi Stephen,   
We are glad to know that your issue has been fixed. Please let us know if you need any further assistance, we will be happy to assist you.  
   
Regards,   
Karthigeyan   
   
 


Loader.
Live Chat Icon For mobile
Up arrow icon