Is there a way to attach to any datasource event error? Something like jquery.on method that attaches also to events for elements that are going to be added in the future.
So what I would like is to display to the user a popup message when an error appears, but I would not like to add to every datasource an event for errors, because I would like to avoid forgetting to add it to a datasource.
6 Answers, 1 is accepted
In Kendo UI events can be attached during the widget's initialization or after its initialization. See the following documentation section, which demonstrates the available ways of attaching events.
Regards,
Ivan Danchev
Progress Telerik
Hi Ivan,
I already know how to attach to a specific datasource event. What I want is to know if there is a way to attach to every datasource events and how.
The two approaches I mentioned can be used to attach handlers to a specific DataSource instance. jQuery.on or other similar methods of attaching events to multiple DataSource instances are not applicable, because the DataSource is not initialized from an HTML element like most of the other widgets, but assigned to a variable. So if you have an array of variables that hold the DataSource instances you can loop over them and attach a handler, but this might be too much of an overhead as opposed to attaching the handler to each DataSource individually.
Regards,
Ivan Danchev
Progress Telerik
Hi Ivan,
I was affraid of that. The reason I want to attach to every datasource is because when something is wrong with the datasource the telerik code does not provide any feedback. So I need to attach to every datasource error event and provide a feedback to the developer that something might be wrong with the code.
Also I have read somewhere that you can overwrite some telerik functionality using the fn object. Would that be an alternative?
The following documentation section contains more details on how custom widgets can be created and custom behavior can be achieved by extending the Kendo UI widgets.
As for whether the particular requirement you aim at implementing can be achieved by extending the DataSource and overriding the existing functionality, this we cannot confirm or deny. The Support Service provides guidance on built-in features, while custom implementations such as the one you are after fall within the scope of professional consulting that can be provided by our Professional Services. They can perform the research required for answering the question whether the customization in question is possible, and can provide guidance or assistance with its implementation, if such is needed. In case you are interested in our colleagues' services, let me know and I will put you in contact with them.
Regards,
Ivan Danchev
Progress Telerik
Hi Ivan,
I do not want to use a custom widget because that would mean that I have to customize any widget that uses a datasource to use the new custom datasource widget. So this is not really a solution. I was hopping that overwriting the telerik datasource with the fn object I could skip the widget customization.
If you don't know about the fn it's OK I will search the forums for it on grid and find how it can be used.