Scheduler globalization cause two calls to LoadData()

Scheduler globalization cause two calls to LoadData()

Hi.
I have a problem globalizing the scheduler according to the guide:

https://ej2.syncfusion.com/aspnetcore/documentation/schedule/localization/#globalization


When adding the code for globalization, the controller's LoadData method (via DataManager) is fired 2 times, causing the data to be queried twice.

I attach one of your examples modified with the globalization code.

Thank you very much for the help.



Attachment: sample1723403503_locale_93aecfc0.zip

1 Reply

RV Ravikumar Venkatesan Syncfusion Team May 5, 2020 02:35 PM UTC

Hi Guillermo, 

Greetings from Syncfusion support. 

We have validated your reported query “When adding the code for globalization, the controller's LoadData method (via DataManager) is fired 2 times” at our end and we have found the cause for this problem is that you have used DOMContentLoaded event on your code for setting up locale to schedule. The LoadData method is fired when the initial rendering of Schedule. If the Schedule initial rendering process is completed the DOMContentLoaded event is triggered and locale set to the Schedule. So, the Schedule again rendering on based on the locale set to it and the LoadData method is again fired. We have resolved this problem with the help of below code. 

<ejs-schedule id="schedule" locale="es" width="100%" height="650px" currentView="TimelineMonth"> 
    <e-schedule-views> 
        <e-schedule-view option="TimelineDay" displayName="Day"></e-schedule-view> 
        <e-schedule-view option="TimelineWeek" displayName="Full Week"></e-schedule-view> 
        <e-schedule-view option="TimelineWorkWeek" displayName="Work Week"></e-schedule-view> 
        <e-schedule-view option="TimelineMonth" interval="12" displayName="Full Year"></e-schedule-view> 
        <e-schedule-view option="Agenda" displayName="Agenda"></e-schedule-view> 
    </e-schedule-views> 
    <e-schedule-eventsettings dataSource="dataManager"> 
    </e-schedule-eventsettings> 
</ejs-schedule> 
 
 
<script> 
    loadCultureFiles('es'); 
    function loadCultureFiles(name) { 
        var files = ['ca-gregorian.json', 'numberingSystems.json', 'numbers.json', 'timeZoneNames.json', 'ca-islamic.json']; 
        var loader = ej.base.loadCldr; 
        var loadCulture = function (prop) { 
            var val, ajax; 
            if (files[prop] === 'numberingSystems.json') { 
                ajax = new ej.base.Ajax(location.origin + '/../scripts/cldr-data/supplemental/' + files[prop], 'GET', false); 
            } else { 
                ajax = new ej.base.Ajax(location.origin + '/../scripts/cldr-data/main/' + name + '/' + files[prop], 'GET', false); 
            } 
            ajax.onSuccess = function (value) { 
                val = value; 
            }; 
            ajax.send(); 
            loader(JSON.parse(val)); 
        }; 
        for (var prop = 0; prop < files.length; prop++) { 
            loadCulture(prop); 
        } 
    } 
</script> 


Kindly try the above sample and get back to us If you would require further assistance. 

Regards, 
Ravikumar Venkatesan 


Loader.
Up arrow icon