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

Can't use this.JsRuntime.Ejs() to use globalization for Scheduler

I have found some instructions on this forum to use something like this to get the Scheduler to support the German language but there's no definition for a method Ejs() in JsRuntime for me. Is there any change there and it has to be done differently now?

[Inject]
    IJSRuntime JsRuntime { get; set; }
    protected override void OnAfterRender()
    {
         this.JsRuntime.Ejs().LoadLocaleData("wwwroot/ej2-locale/src/de.json").SetCulture("de").LoadCldrData(new string[] { "wwwroot/cldr-data/main/de/ca-gregorian.json", "wwwroot/cldr-data/main/de/timeZoneNames.json", "wwwroot/cldr-data/main/de/numberingSysytems.json" });
    }

3 Replies

NR Nevitha Ravi Syncfusion Team October 17, 2019 12:24 PM UTC

Hi Andreas, 

Greetings from Syncfusion Support. 

The cause for the reported problem is you may missed to import Syncfusion.EJ2.Blazor in your application. We have prepared a sample with German culture which can be referred from the following link. 

@using Syncfusion.EJ2.Blazor 
@using Syncfusion.EJ2.Blazor.Schedule 
@using Microsoft.JSInterop 
 
<EjsSchedule TValue="AppointmentData" Height="650px" SelectedDate="@(new DateTime(2018, 2, 14))"> 
    <ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings> 
</EjsSchedule> 
 
@code { 
    [Inject] 
    IJSRuntime JsRuntime { get; set; } 
    protected override void OnAfterRender(bool firstRender) 
    { 
        this.JsRuntime.Ejs().LoadLocaleData("wwwroot/locale.json").SetCulture("de").LoadCldrData(new string[] { "wwwroot/ca-gregorian.json", "wwwroot/timeZoneNames.json", "wwwroot/numbers.json" }); 
    } 
    List<AppointmentData> DataSource = new List<AppointmentData> 
    { 
        new AppointmentData { Id = 1, Subject = "Paris", StartTime = new DateTime(2018, 2, 13, 10, 0, 0) , EndTime = new DateTime(2018, 2, 13, 12, 0, 0) }, 
        new AppointmentData { Id = 2, Subject = "Germany", StartTime = new DateTime(2018, 2, 15, 10, 0, 0) , EndTime = new DateTime(2018, 2, 15, 12, 0, 0) } 
    }; 
    public class AppointmentData 
    { 
        public int Id { get; set; } 
        public string Subject { get; set; } 
        public string Location { get; set; } 
        public DateTime StartTime { get; set; } 
        public DateTime EndTime { get; set; } 
        public string Description { get; set; } 
        public bool IsAllDay { get; set; } 
        public string RecurrenceRule { get; set; } 
        public string RecurrenceException { get; set; } 
        public Nullable<int> RecurrenceID { get; set; } 
    } 
} 

We have refreshed our documentation with proper import section and code snippets. 

Regards, 
Nevitha 
 



AO Andreas Oelke October 17, 2019 02:28 PM UTC

Thanks. This works fine now.
I forgot to to include
@using Syncfusion.EJ2.Blazor 
indeed.


NR Nevitha Ravi Syncfusion Team October 18, 2019 05:05 AM UTC

Hi Andreas, 
  
You are most welcome. We are always happy to assist you. 
  
 Regards, 
Nevitha 


Loader.
Live Chat Icon For mobile
Up arrow icon