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

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

Thread ID:

Created:

Updated:

Platform:

Replies:

148360 Oct 16,2019 11:35 AM UTC Oct 18,2019 05:05 AM UTC Blazor 3
loading
Tags: Scheduler
Andreas Oelke
Asked On October 16, 2019 11:35 AM UTC

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

Nevitha Ravi [Syncfusion]
Replied On 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 
 


Andreas Oelke
Replied On October 17, 2019 02:28 PM UTC

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

Nevitha Ravi [Syncfusion]
Replied On October 18, 2019 05:05 AM UTC

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


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