Declined
Last Updated: 05 Jul 2021 14:09 by ADMIN
Mark
Created on: 01 Mar 2016 15:00
Category: Kendo UI for jQuery
Type: Feature Request
6
Add capability to determine when all Kendo controls have been databound
The only way to detect when a control has completed binding to a datasource is via it's dataBound event. When you need to know if multiple controls have been dataBound it creates a less than ideal situation.

A common scenario I encounter is when I have a search view with multiple dropdownlists and I need to set default values in those dropdownlists prior to loading a Kendo grid with search results based on the selections in the dropdownlists. Note: these are not cascading dropdowns - each dropdownlist is independent of the others. 

In order to set the selected values in each dropdownlist I have to know when each one is databound and only then can I set the selected value. Once all dropdownlists are databound then I can refresh the grid based on those selections. 

In order to make this work I have to "chain" the dropdownlists together. To do this I set the first dropdownlist AutoBind = true and the rest false. When the first dropdownlist dataBound event fires my JavaScript selects the correct value in that dropdownlist and refreshes the datasource on the next dropdownlist in the chain. When its dataBound event fires I select its value and refresh the next dropdownlist's datasource in the chain and so forth. This pattern continues until all dropdownlists are databound. In the last dropdownlist dataBound event handler I refresh the grid's datasource now that all the default selections have been made. 

This implementation is messy and cumbersome. It would be nice to have a parent Kendo ajax manager that all databound controls in the view could register with when the view loads. Then each databound control would notify the ajax manager when it is databound. The ajax manager would then fire an event to indicate that all controls have been databound. Then my code could handle setting the default dropdownlist values and refreshing the grid in one event handler which would be much cleaner than the current approach.
1 comment
ADMIN
Angel Petrov
Posted on: 05 Jul 2021 14:09

Hello,

The problem with implementing a single event is that controls can be created asynchronously and at a different time than the rest. There is no way that we can detect that a component will be created at a later point in time and that it will be databound. That said for the specific case one can handle things manually, as already done and subscribe to each individual component event.

Regards,
Angel Petrov
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/.