This is a migrated thread and some comments may be shown as answers.

Dropdown DataBound event?

4 Answers 2408 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Bobby
Top achievements
Rank 1
Bobby asked on 02 May 2012, 09:21 PM
Is there any way to tell through an event type mechanism when the drop down is done binding to data?  I am loading a drop down with a list through a datasource bound to remote data and need to initialize the value based on another data field retrieved previously.  I also need to fill in other controls through MVVM based on the data in the drop down list, so simply setting the drop down list initial value isn't enough for this.

The time to load the drop down seems to vary, and a timeout isn't working very well at that point, so it would be helpful to know when the drop down is finished and can safely have its value set through code.

If there is no event (which it doesn't appear there is from the documentation) is there a known way to handle this situation?  I should probably point out that I'm fairly new to javascript, so if there is something obvious that I'm missing, please excuse my ignorance!

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 03 May 2012, 02:30 PM
Hi Bobby,

The dropDown widget has a dataBound event which is similar to the grid's dataBound event and will fire when the data is received.
$("#dropdown").kendoDropDownList({
    dataTextField: "Name",
    dataValueField: "Id",
    dataSource: ds,
    dataBound: function(e) {
       //...
    }
});

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Troy
Top achievements
Rank 1
answered on 22 Jun 2012, 04:48 PM
You guys may want to update the documentation for the dropdownlist widget. It doesn't mention a dataBound event anywhere that I can see.
0
Mayank
Top achievements
Rank 1
answered on 04 Oct 2012, 08:56 PM
I cannot seem to find a helper method to assign a handler to the DataBound event from Kendo ASP.NET MVC extensions.
Given that the event exists, is there a workaround?
0
Alexander Valchev
Telerik team
answered on 08 Oct 2012, 01:02 PM
Hi guys,

@Troy
Thank you for the feedback. I am glad to inform you that the dataBound event is documented now.

@Mayank
The event is not yet available in the MVC wrappers, but we will do our best to fill the gap as soon as possible. Meanwhile you can catch the event which JavaScript after the widget initialization.
// get a reference to the dropdown list
var dropdownlist = $("#dropdownlist").data("kendoDropDownList");
// bind to the close event
dropdownlist.bind("dataBound", function(e) {
    // handle event
});


Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Bobby
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Troy
Top achievements
Rank 1
Mayank
Top achievements
Rank 1
Share this question
or