- Home
- Forum
- ASP.NET Core - EJ 2
- BUG: Uncaught TypeError - cannot convert undefined or null to object(inline editing and datepicker) - Version 19.4.0.47
BUG: Uncaught TypeError - cannot convert undefined or null to object(inline editing and datepicker) - Version 19.4.0.47
Hi ,
after click on the datetime-column i get the following error:
you can reproduce this problem very easily (see attachments)
thanks!
Viktor
Attachment: Grid_UrlAdapter_DateTime_Edit_947cd0b8.zip
SIGN IN To post a reply.
5 Replies
JC
Joseph Christ Nithin Issack
Syncfusion Team
January 31, 2022 03:54 PM UTC
Hi Viktor,
Greetings from Syncfusion support.
Based on your requirement, you were getting script error when editing the grid with a dateColumn. On inspecting the sample provided, we have found that when setting the culture using setCulture method the issue is persists and if we remove that the issue is resolved. We are validating the issue from our end and we will provide further details on or before 2nd February, 2022. We appreciate your patience until then.
Please get back to us for further details.
Regards,
Joseph I.
PM
Ponmani Murugaiyan
Syncfusion Team
February 2, 2022 09:27 AM UTC
Hi Viktor,
We checked your reported query based on your provided sample and you are getting the console error “Cannot convert undefined or null to object”. The cause for the reported error is culture not loaded properly in your sample. You need to load the corresponding culture files as like below code snippet.
For more information, please refer the below documentation:
To go with the different culture other than English, follow the steps. Install the CLDR-Data package by using the below command (it installs the CLDR JSON data).
|
npm install cldr-data --save |
Once the package installed, you can find the culture specific JSON data under the location \node_modules\cldr-data.
In ASP.NET Core, the static file contents are should present under wwwroot folder. For this, manually copy the CLDR-Data from the node_modules folder and place inside the wwwroot folder and refer from the \wwwroot\scripts\cldr-data location as like the below code examples.
|
<ejs-datepicker id="datepicker" format="yyyy-MM-dd" value="@DateTime.Now.Date"></ejs-datepicker>
<script>
document.addEventListener('DOMContentLoaded', function () {
datepicker = document.getElementById('datepicker').ej2_instances[0];
var L10n = ej.base.L10n;
L10n.load({
'de': {
'datepicker': {
placeholder: 'Wählen Sie ein Datum',
today: 'heute'
}
}
});
loadCultureFiles('de');
ej.base.setCurrencyCode('EUR');
ej.base.setCulture('de');
});
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
if (name === 'ar') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'ar' && prop === files.length - 1) {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../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> |
We have prepared sample and attached below:
Regards,
Ponmani M
VI
Viktor
February 6, 2022 12:55 PM UTC
Hi,
It works, much appreciated!!
thank you for your support!
regards
Viktor
PM
Ponmani Murugaiyan
Syncfusion Team
February 7, 2022 04:14 AM UTC
Hi Viktor,
Welcome, we are glad to hear that the issue has been resolved.
Regards,
Ponmani M
PM
Ponmani Murugaiyan
Syncfusion Team
February 7, 2022 04:14 AM UTC
Hi Viktor,
Welcome, we are glad to hear that the issue has been resolved.
Regards,
Ponmani M
SIGN IN To post a reply.
- 6 Replies
- 3 Participants
-
VI Viktor
- Jan 29, 2022 04:16 PM UTC
- Dec 8, 2023 02:26 PM UTC