Disable, Enable and rebind the DropDownList

3 posts, 0 answers
  1. Suthish
    Suthish avatar
    13 posts
    Member since:
    May 2015

    Posted 14 Jun 2015 Link to this post

    Hi,

    I tried to disable and enable the DropDownList control. But after enabling again, the data seems to lost or not rebinding again.

     

    disabled

    $("#dropdownlist").kendoDropDownList({
      enable: false
    });

     

    enabled

    $("#dropdownlist").kendoDropDownList({
      enable: true
    });

     

    Here its get enabled again, but data not listing?

  2. Suthish
    Suthish avatar
    13 posts
    Member since:
    May 2015

    Posted 15 Jun 2015 Link to this post

    This worked, not sure whats the difference...

    disable

    var dropdownlist = $("#period").data("kendoDropDownList");
    dropdownlist.enable(false);

     

    enable
    dropdownlist.enable(true);

     

     

  3. Kendo UI is VS 2017 Ready
  4. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 16 Jun 2015 Link to this post

    Hello Suthish,

    The right way to enable or disable a DropDownList is to get an instance of the widget and use its enable() method. 

    var dropdownlist = $("...").data("kendoDropDownList");
    dropdownlist.enable(false);
    dropdownlist.enable(true);

    Using the code below twice is not recommended since it re-initializes the widget.

    $("#dropdownlist").kendoDropDownList({
      
    });


     

    Regards,
    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