Hi,
When I call grid.datasource.sync() on a datasource that has a model id defined, but this field is unmapped, I get a cryptic error. You can find a reproducer here: https://dojo.telerik.com/iLacazot
Uncaught TypeError: o is undefined
setup http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
create http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
_promise http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
Deferred jQuery
_promise http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
_send http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
sync http://127.0.0.1/a/kendo-ui/js/kendo.all.min.js:28
<anonymous> http://127.0.0.1/a/program/discount/search/:4058
On a slightly related subject; When checking the docs on the model id it seems that the example is missing from this page:
https://docs.telerik.com/kendo-ui/api/javascript/data/model/fields/id
Hello Lynn,
It is technically impossible to have proper configuration validation over vanilla JS as models and definitions are ambiguous by nature. Such validation can come with TypeScript where you would be able to define a model by using a Class and that class to be validated. However, with JS you do not have types so that you could get runtime, build-time or intellisense errors about wrong definitions.
Regards,
Ianko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello Lynn,
I am afraid with JS it is not so easy to provide straightforward error messages that would help developers resolve any type of error that may result by misconfiguration of a widget, utility or component.
In this case, the wrong definition entirely breaks the processing of data operations which results in errors later in the code. Before that, we cannot somehow in code predict what data is going to be fetched and define the model definition as invalid and somehow throw a meaningful error that the id definition is wrong.
Regards,
Ianko
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Lynn,
The model that is set with an id field should always have the id field defined and set to a unique value. The DataSource uses that id field to process the items and consider if the item is new or being updated. Thus, when the model is defined with an id field, but it's undefined it is normal JS error to be thrown.
As for the example, you can refer to this one: https://docs.telerik.com/kendo-ui/api/javascript/data/model/methods/define.
Regards,
Ianko
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.