Dropdown DataBound event?

5 posts, 0 answers
  1. Bobby
    Bobby avatar
    1 posts
    Member since:
    May 2010

    Posted 02 May 2012 Link to this post

    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!

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2187 posts
    Member since:
    Sep 2012

    Posted 03 May 2012 Link to this post

    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!

  3. Troy
    Troy avatar
    31 posts
    Member since:
    Oct 2011

    Posted 22 Jun 2012 Link to this post

    You guys may want to update the documentation for the dropdownlist widget. It doesn't mention a dataBound event anywhere that I can see.

  4. Mayank
    Mayank avatar
    3 posts
    Member since:
    Aug 2010

    Posted 04 Oct 2012 Link to this post

    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?

  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2187 posts
    Member since:
    Sep 2012

    Posted 08 Oct 2012 Link to this post

    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!

Back to Top