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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

EventTemplate

Thread ID:

Created:

Updated:

Platform:

Replies:

146005 Jul 17,2019 08:04 AM UTC Aug 2,2019 11:09 AM UTC Blazor 4
loading
Tags: Scheduler
Otmar Ganahl
Asked On July 17, 2019 08:04 AM UTC


Is there way to customize the look of an event in the scheduler?
Any Text or html-Text in EventTemplate does not work.

Steven Littleford
Replied On July 18, 2019 03:23 AM UTC

Yep - mee too!

I'd like to be able to change the color of an appointment based on the underlying data within the appointment.


Hareesh Balasubramanian [Syncfusion]
Replied On July 18, 2019 12:22 PM UTC

Hi Otmar, 

Greetings from Syncfusion Support. 

We have prepared the sample to customize the event using Template option which can be downloaded from the following link, 

    <ScheduleEventSettings DataSource="@DataSource"> 
        <Template> 
            <div>Subject: @((context as dynamic).Subject)</div> 
            <div>StartTime: @((context as dynamic).StartTime)</div> 
            <div>EndTime:  @((context as dynamic).EndTime)</div> 
        </Template> 
    </ScheduleEventSettings> 

Please try the above sample, if you have any concerns please revert us back for further assistance. 

Note: We have removed the packages for the above sample. 

Regards, 
Hareesh B 


Hareesh Balasubramanian [Syncfusion]
Replied On July 18, 2019 12:25 PM UTC

Hi Steven, 

Greetings from Syncfusion Support. 

We have prepared the sample for your requirement using eventRendered event which can be downloaded from the following link, 
  
public void onEventRendered(EventRenderedArgs args) 
    BlogSite bsObj = JsonConvert.DeserializeObject<BlogSite>(JsonConvert.SerializeObject(args.Data)); 
    DateTime localDate = bsObj.StartTime.ToLocalTime(); 
    var hours = localDate.TimeOfDay.Hours; 
    if (hours < 12) 
    { 
        (args.Element).AddClass(this.cus1_class); 
    } 
    else if (hours >= 12 && hours < 18) 
    { 
        (args.Element).AddClass(this.cus2_class); 
    } 
    else if (hours >= 18) 
    { 
        (args.Element).AddClass(this.cus3_class); 
    } 

Please try the above sample, if you have any concerns please revert us back for further assistance. 

Note: We have removed the packages for the above sample. 

Regards, 
Hareesh B 


Matthew
Replied On August 2, 2019 11:09 AM UTC

Hi Hareesh,

I first had a problem with having to add Microsoft.CSharp to the project and making sure to add @using Microsoft.CSharp.RuntimeBinding
I have tried adapting this and I get a javascript error in the console - this.adaptor.processQuery is not a function
I am using version 17.2.0.35, however I am using a custom model for TemplateArgs and not using th standard fields the following code should make it clear:

   
       
   
   
       
   

@code{
    public class TemplateArgs
    {
        public string Workcode { get; set; }
        public string WorkcodeName { get; set; }
        public string CandidateName { get; set; }
        public string CandidateColor { get; set; }
        public string TimesheetColor { get; set; }
        public bool AllDay { get; set; }
    }

    List _summary = new List();
    public TemplateArgs model = new TemplateArgs();

    protected override async Task OnInitAsync()
    {
        _summary = await assignmentDataService.GetAssignmentItemSummary(7000, null, null, null, null);
        StateHasChanged();
    }
}

Can you see anything wrong with what I have done?

Please ignore, I was not setting start time and end time in my data source


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon